1#! /bin/sh
2#A script for combining the legacy ChangeLog found in ChangeLog-CVS with one output from git. The script will only run if the current ChangeLog contains exactly one line.
3#This makes it possible to do a new "make dist" from an existing source distribution (as the ChangeLog would then be complete.).
4top_srcdir=$1
5distdir=$2
6commitid=$3
7if [ x${distdir} = "x" ] || [ x${top_srcdir} = "x" ] || [ x${commitid} = "x" ]; then
8	echo "This script will generate an aggregated ChangeLog by combining the legacy ChangeLog-CVS file with the output from git log. It therefore needs to be run in a git source directory."
9	echo "Params: <source directory path> <distribution directory path> <SHA1 of first git commit>"
10	exit 1
11fi
12#Only do the aggregation if the ChangeLog file is exactly one line. If not the aggregation has already been done.
13if [ `cat ${distdir}/ChangeLog | wc -l` = "0" ]; then
14	echo "Generating ChangeLog by appending the old CVS ChangeLog to the one generated from git. This requires that you create the dist in the git repository."
15
16	chmod u+w ${distdir}/ChangeLog && git log ${commitid}..HEAD --stat --name-only --date=short --abbrev-commit > ${distdir}/ChangeLog && echo "" >> ${distdir}/ChangeLog && cat ${top_srcdir}/support/ChangeLog-CVS >> ${distdir}/ChangeLog
17	#Put a notice in the legacy ChangeLog-CVS file, thus bringing the size of the dist down a bit.
18	chmod u+w ${distdir}/support/ChangeLog-CVS && echo "This file was needed for generating the proper ChangeLog as an aggregate of the code held in git and older code in CVS. It's now empty, but needs to be included in the source distribution to not upset automake." > ${distdir}/support/ChangeLog-CVS
19fi
20