{"thread":{"id":"27120","subject":"Generating GNU-style Changelog from git commits","startedAt":"2011-04-16T22:46:37Z","lastAt":"2011-04-17T15:14:35Z","messageCount":4,"participants":["David Chanters","Chris Packham","Marcus D. Hanwell"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"165991","messageId":"BANLkTi=j_Ge9h8+r8R-a5Fppan_2dtu5LA@mail.gmail.com","threadId":"27120","inReplyTo":null,"subject":"Generating GNU-style Changelog from git commits","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2011-04-16T22:46:37Z","receivedAt":"2011-04-16T22:46:37Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"[Please Cc me on replies.  Thanks!]\n\nHi,\n\nSome projects maintain a ChangeLog file, which looks something like this:\n\n2011-01-01  David Chanters  <d.c@example.com>\n        * foo/bar.c (some_function):\n         Changed static variable in some_function to auto.\n\netc., etc.\n\nHere \"foo\" is some directory relative to the top-level directory the\n.git one is in.\n\nThese ChangeLog files are maintained manually, irrespective of the/any\nrevision control system in use.  I am wondering if it's possible if\nthe project is in Git to be able to automatically append to such a\nChangeLog file with each commit automatically, and have it formatted\nin the style above.\n\nIs this possible?  Is it a solved problem?  If not, and I wanted to\ntry myself, could someone point me at the git-specific tools I'd need\nto know to use to achieve it?\n\nTIA!\nDC\n"},{"id":"165995","messageId":"4DAA3A0D.6070904@gmail.com","threadId":"27120","inReplyTo":"BANLkTi=j_Ge9h8+r8R-a5Fppan_2dtu5LA@mail.gmail.com","subject":"Re: Generating GNU-style Changelog from git commits","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2011-04-17T00:53:33Z","receivedAt":"2011-04-17T00:53:33Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 17/04/11 10:46, David Chanters wrote:\n> [Please Cc me on replies.  Thanks!]\n>\n> Hi,\n>\n> Some projects maintain a ChangeLog file, which looks something like this:\n>\n> 2011-01-01  David Chanters<d.c@example.com>\n>          * foo/bar.c (some_function):\n>           Changed static variable in some_function to auto.\n>\n> etc., etc.\n>\n> Here \"foo\" is some directory relative to the top-level directory the\n> .git one is in.\n>\n> These ChangeLog files are maintained manually, irrespective of the/any\n> revision control system in use.  I am wondering if it's possible if\n> the project is in Git to be able to automatically append to such a\n> ChangeLog file with each commit automatically, and have it formatted\n> in the style above.\n>\n> Is this possible?  Is it a solved problem?  If not, and I wanted to\n> try myself, could someone point me at the git-specific tools I'd need\n> to know to use to achieve it?\n>\n> TIA!\n> DC\n> --\n\nShouldn't be to hard, there are numerous hooks that could be used either \non the developer end (post-commit), on the server end (post-update) or \neven when a maintainer applies a patch (post-applypatch). See \ngithooks(5) for more info on what hooks are available and what args are \npassed.\n\nThere is also the possibility of generating this changelog at the time \nof release. I'd advocate this approach as it would allow you to edit the \nchangelog to make it more useful to readers.\n\nEither way the actual format could probably be generated with 'git log \n--format' (someone else may reply with better plumbing commands, but my \ninitial response is use git log).\n\nMy 2 minutes worth of reading git-log(1) got me this\n\n   git log --format=\"%ai%x09%an <%ae> %n%x09* %s\" REVISIONS\n\nWhich for a chunk of gits pu branch gave me this (my mail client munges \nsome of the longer lines)\n\n2011-02-17 13:54:28 -0800\tJunio C Hamano <gitster@pobox.com>\n\t* Merge branch 'js/cherry-pick-usability' into pu\n2011-02-17 12:29:33 -0800\tJunio C Hamano <gitster@pobox.com>\n\t* Merge branch 'so/submodule-no-update-first-time' into pu\n2011-02-17 12:29:32 -0800\tJunio C Hamano <gitster@pobox.com>\n\t* Merge branch 'jc/grep--no-index-pathspec-fix' into pu\n2011-02-17 09:18:46 -0700\tSpencer E. Olson <olsonse@umich.edu>\n\t* t7406: \"git submodule update {--merge|--rebase]\" with new submodules\n2011-02-17 09:18:45 -0700\tSpencer E. Olson <olsonse@umich.edu>\n\t* submodule: no [--merge|--rebase] when newly cloned\n2011-02-16 14:39:00 -0800\tJunio C Hamano <gitster@pobox.com>\n\t* grep --no-index: honor pathspecs correctly\n2011-02-16 05:08:23 -0500\tJay Soffian <jaysoffian@gmail.com>\n\t* Teach commit about CHERRY_PICK_HEAD\n2011-02-16 12:20:35 -0500\tJay Soffian <jaysoffian@gmail.com>\n\t* Introduce CHERRY_PICK_HEAD\n\nWhich is pretty close. You could experiment with more format specifiers \nto get the info you need.\n\nHope that helps\n- Chris\n"},{"id":"165997","messageId":"BANLkTikQvOkoFSXXC3oUKQfASo8==qdgxA@mail.gmail.com","threadId":"27120","inReplyTo":"4DAA3A0D.6070904@gmail.com","subject":"Re: Generating GNU-style Changelog from git commits","fromName":"Marcus D. Hanwell","fromEmail":"marcus.hanwell@kitware.com","sentAt":"2011-04-17T01:47:58Z","receivedAt":"2011-04-17T01:47:58Z","isPatch":false,"sender":{"key":"marcus.hanwell@kitware.com","avatar":null},"body":"On Sat, Apr 16, 2011 at 8:53 PM, Chris Packham <judge.packham@gmail.com> wrote:\n> On 17/04/11 10:46, David Chanters wrote:\n>>\n>> [Please Cc me on replies.  Thanks!]\n>>\n>> Hi,\n>>\n>> Some projects maintain a ChangeLog file, which looks something like this:\n>>\n>> 2011-01-01  David Chanters<d.c@example.com>\n>>         * foo/bar.c (some_function):\n>>          Changed static variable in some_function to auto.\n>>\n>> etc., etc.\n>>\n>> Here \"foo\" is some directory relative to the top-level directory the\n>> .git one is in.\n>>\n>> These ChangeLog files are maintained manually, irrespective of the/any\n>> revision control system in use.  I am wondering if it's possible if\n>> the project is in Git to be able to automatically append to such a\n>> ChangeLog file with each commit automatically, and have it formatted\n>> in the style above.\n>>\n>> Is this possible?  Is it a solved problem?  If not, and I wanted to\n>> try myself, could someone point me at the git-specific tools I'd need\n>> to know to use to achieve it?\n>\n> Shouldn't be to hard, there are numerous hooks that could be used either on\n> the developer end (post-commit), on the server end (post-update) or even\n> when a maintainer applies a patch (post-applypatch). See githooks(5) for\n> more info on what hooks are available and what args are passed.\n>\n> There is also the possibility of generating this changelog at the time of\n> release. I'd advocate this approach as it would allow you to edit the\n> changelog to make it more useful to readers.\n\nSomething I wrote a few years ago does this for us. It may not be\nperfect, but there was a desire to have a Changelog in our released\ntarballs,\n\nhttps://github.com/cryos/avogadro/blob/master/scripts/gitlog2changelog.py\n\nIf there are better ways of doing this I would certainly be\ninterested, but have not spent much time on this since writing the\ninitial script. We had a similar desire, but didn't want to end up\nresolving conflicts around a file in version control.\n\nMarcus\n"},{"id":"166012","messageId":"BANLkTi=bGnT6n9WqGz309ZPgzL9KRAkMzQ@mail.gmail.com","threadId":"27120","inReplyTo":"BANLkTikQvOkoFSXXC3oUKQfASo8==qdgxA@mail.gmail.com","subject":"Re: Generating GNU-style Changelog from git commits","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2011-04-17T15:14:35Z","receivedAt":"2011-04-17T15:14:35Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"On 17 April 2011 02:47, Marcus D. Hanwell <marcus.hanwell@kitware.com> wrote:\n> https://github.com/cryos/avogadro/blob/master/scripts/gitlog2changelog.py\n>\n> If there are better ways of doing this I would certainly be\n> interested, but have not spent much time on this since writing the\n> initial script. We had a similar desire, but didn't want to end up\n> resolving conflicts around a file in version control.\n\nThanks, all.  I shall look into it.   :)\n\nDavid\n"}]}