Change build system to generate ChangeLog from Git log #10

wants to merge 1 commit into


None yet
2 participants

codebrainz commented Oct 30, 2011

From information found here:

Maybe we want to customize the git log format a bit.

I also wrote a Python script that can print a list of unique AUTHORS and COMMITTERS sorted by number of commits as well as generate the ChangeLog but I wasn't sure if it was OK to have Python be required for make dist commands.

The dist-hook would look something like:

  @echo "  Generating AUTHORS..." && \
    python $(top_srcdir)/scripts/geany-git -a $(top_srcdir) > $(distdir)/AUTHORS
  @echo "  Generating COMMITTERS..." && \
    python $(top_srcdir)/scripts/geany-git -c $(top_srcdir) > $(distdir)/COMMITTERS
  @echo "  Generating ChangeLog..." && \
    python $(top_srcdir)/scripts/geany-git -l $(top_srcdir) > $(distdir)/ChangeLog

This script can be found here.


b4n commented Oct 30, 2011

It may be cool to have a more changelog-like log format, but I'm afraid it'd be quite a pain and would need a not-that-trivial script, which is not necessarily worth it (either the write or the distribution).

Also, I don't want to remove the current changelog, but rather move it to ChangeLog.pre-1.22 and start a new one since 0.21.0 tag or something.

For the AUTHORS and COMMITTERS, I guess a simple git log --pretty='format:%aN <%aE>' | sort | uniq with an appropriate .mailmap to filter out those weird guys who used more than one email (hehe) would do the trick. Of course the format would use %cN and %cE for COMMITTERS.

And I'm not sure I really like depending on Python at dist time… I agree everybody has Python nowadays, but it'd still be a new dependency -- and the script would also need to support "old" Python versions.

I'll play with this a bit, see what I end up with and tell you again


codebrainz commented Oct 31, 2011

Formatting the ChangeLog shouldn't be too difficult in Python, but if we don't want to use that, then yeah it would become much harder using git log --format=.

For the AUTHORS and COMMITTERS files, the only thing I like better in my script is that the people are sorted by number of commits which yields better results IMO (ex. if Andrew Abraham authors one single commit and never any more, why should he be listed above someone with thousands of commits).


b4n commented Oct 31, 2011

It would need to correctly parse the output and merge it as needed, then output. Well, again, not sure it's worth it.

True for the sorting part. What about git log --pretty=format:'%aN <%aE>' | sort | uniq -c | sort -bnr | sed 's/^[ 0-9]* //'? :D Much less simple, but works fine ^^


b4n commented Jun 30, 2012

For the record, I committed an alternative git-log-to-changelog thing with 2927577.

The AUTHORS/COMMITTERS part isn't done though because it's way harder: simply listing people Git knows as committers gives wrong results if we merged changes committed by any random guy on another repo, which is quite common with the pull-based approach. So this isn't done for now, waiting for a good solution.


codebrainz commented Jun 30, 2012

Sounds good. I'll close this since the main topic is done. The AUTHORS and COMMITTERS stuff is just a bonus :)

@codebrainz codebrainz closed this Jun 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment