Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>
Clone
HTTPS:
git clone https://vervis.peers.community/repos/yEzqv
SSH:
git clone USERNAME@vervis.peers.community:yEzqv
Branches
Tags
changelog.mdwn
When using git, maintaining a ChangeLog file manually is redundant. It can be generated automatically from git log
when the distribution tarball is created. The general idea is:
- Have a script which runs when the dist-hook is trigerred
- Make that script generate the ChangeLog from the git commit log
Here are examples from several projects.
Rhythmbox
This is from the bottom of the top-level Makefile.am:
[[!format make """ CHANGELOG_START = RHYTHMBOX-0_12_0
ChangeLog: @echo Creating $@ @if test -d "$(srcdir)/.git"; then
(GIT_DIR=$(top_srcdir)/.git ./missing –run git log $(CHANGELOG_START).. –stat) > $@.tmp
&& mv -f $@.tmp @ ||((RM) $@.tmp;
echo Failed to generate ChangeLog. Your ChangeLog may be outdated >&2;
(test -f $@ || echo git-log is required to generate this file >> $@));
else
test -f $@ ||
(echo A git checkout and git-log is required to generate ChangeLog >&2 &&
echo A git checkout and git-log is required to generate this file >> $@);
fi
.PHONY: ChangeLog """]]
git2cl
I installed it here locally, /usr/bin/git2cl is a Perl script. You can take a look and copy it into the wiki for easier reference, or paste a link there. Looks much longer than the scripts GNOME uses, but I need to compare output in order to determine what’s the difference.
Automake
First, this is from maintainer/maint.mk:
[[!format make """ # ——————————————————— # # Automatic generation of the ChangeLog from git history. # # ——————————————————— #
gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog gitlog_to_changelog_fixes = (srcdir)/.git − log − fixgitlogtochangelogoptions = − − amend=(gitlog_to_changelog_fixes)
–since=‘2011-12-28 00:00:00’
–no-cluster –format ‘%s%n%n%b’
EXTRA_DIST += lib/gitlog-to-changelog EXTRA_DIST += $(gitlog_to_changelog_fixes)
When executed from a git checkout, generate the ChangeLog from the git
history. When executed from an extracted distribution tarball, just
copy the distributed ChangeLog in the build directory (and if this
fails, or if no distributed ChangeLog file is present, complain and
give an error).
The ChangeLog should be regenerated unconditionally when working from
checked-out sources; otherwise, if we’re working from a distribution
tarball, we expect the ChangeLog to be distributed, so check that it
is indeed present in the source directory.
ChangeLog: $(AM_V_GEN)set -e; set -u;
if test -d $(srcdir)/.git; then
rm -f $@-t
&& $(gitlog_to_changelog_command)
(gitlogtochangelogoptions)>@-t
&& chmod a-w $@-t
&& mv -f $@-t $@
|| exit 1;
elif test ! -f (srcdir)/@; then
echo “Source tree is not a git checkout, and no pre-existent”
“$@ file has been found there” >&2;
exit 1;
fi .PHONY: ChangeLog """]]
Now, here’s the command that script refers to:
http://git.savannah.gnu.org/cgit/automake.git/tree/lib/gitlog-to-changelog
GTK+
Very similar to Rhythmbox:
[[!format make """ ChangeLog: $(AM_V_GEN) if test -d "$(srcdir)/.git"; then
(GIT_DIR=$(top_srcdir)/.git ./missing –run git log GTK_2_16_0^^.. –stat) | fmt –split-only > $@.tmp
&& mv -f $@.tmp @ ||((RM) $@.tmp;
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2;
(test -f $@ || echo git-log is required to generate this file >> $@));
else
test -f $@ ||
(echo A git checkout and git-log is required to generate ChangeLog >&2 &&
echo A git checkout and git-log is required to generate this file >> $@);
fi
.PHONY: ChangeLog """]]
Claws Mail
This is from the Makefile.am:
[[!format make """ dist-local: ChangeLog
maintainer-clean-local: @rm -f ChangeLog @rm -f version
ChangeLog: version @./tools/gitlog2changelog.py 3.9.0 > ChangeLog """]]
And this is the Python script:
http://git.claws-mail.org/?p=claws.git;a=blob;f=tools/gitlog2changelog.py
Glade
From top-level Makefile.am:
[[!format make """ dist-hook: @if test -d “$(srcdir)/.git"; \
then \
echo Creating ChangeLog && \
( cd "$(top_srcdir)” &&
echo ‘# Generated by Makefile. Do not edit.’; echo;
$(top_srcdir)/missing –run git log –stat ) > ChangeLog.tmp
&& mv -f ChangeLog.tmp $(distdir)/ChangeLog
|| ( rm -f ChangeLog.tmp ;
echo Failed to generate ChangeLog >&2 );
else
echo A git clone is required to generate a ChangeLog >&2;
fi """]]
Gtanslator
From top-level Makefile.am:
[[!format make """ dist-hook: @if test -d "$(srcdir)/.git"; \ then \ echo Creating ChangeLog && \ (GIT_DIR=$(top_srcdir)/.git \ ./missing --run git log $(CHANGELOG_START)^^.. --stat -M -C --name-status --date=short --no-color) | \ fmt --split-only > ChangeLog.tmp \ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ || ( rm -f ChangeLog.tmp ; \ echo Failed to generate ChangeLog >&2 ); \ else \ echo A git clone is required to generate a ChangeLog >&2; \ fi """]]
gnome-common
[[!format make """ # Build ChangeLog from GIT history ChangeLog: $(AM_V_GEN) if test -d $(top_srcdir)/.git; then \
GIT_DIR="$(top_srcdir)/.git" git log –stat > $@;
fi
dist: ChangeLog
.PHONY: ChangeLog """]]
mm-common
[[!format make """ if MAINTAINER_MODE dist-hook: dist-changelog else dist-hook: endif
.PHONY: dist-changelog
dist-changelog: (AMVat)ifgit − − git − dir=(top_srcdir)/.git –work-tree=$(top_srcdir)
log –no-merges –date=short –pretty=‘tformat:%cd %an <%ae>%n%n%s%n%n%b’ |
(SED) − e′/[12]... − [01]. − [0123].[< > ] * < [< > ] * >$/,/^$/b′ − e′/[]/, /[]*/!d′ − e′s/[] * //′ − e′s/[]*$//' >.ChangeLog.tmp; \
then mv -f .ChangeLog.tmp "$(top_distdir)/ChangeLog“;
else rm -f .ChangeLog.tmp; exit 1; fi”""]]
Important note: While many repositories simply don’t have any changelog at all, mm-common has a short ChangeLog file which explains where to see the changes. This is smart because people who expect to find it there will know where it is.