[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generate a changelog from cvs!

From: Greg A. Woods
Subject: Re: Generate a changelog from cvs!
Date: Fri, 8 Oct 2004 17:40:20 -0400 (EDT)

[ On , October 4, 2004 at 07:28:59 (-0700), Goran wrote: ]
> Subject: Generate a changelog from cvs!
> Can I generate a "changelog" with all "Log messages" between 2 tags in
> cvs? I know how to generate diffs for files and the changes in the
> files but i would like to have another digg with just the "Log
> message" for all files changed between the 2 tags.

There's a really simple GNU-compatible "ChangeLog" generator for RCS
(which has some minor CVS support) included in the CVS source package in
the contrib sub-directory.  It simply processes "cvs [r]log" output.

Here's an example of how it can be used automatically to generate a
GNU-compatible ChangeLog file for all the changes on the trunk since the
last release tag was made (i.e. just before the new tag for the new
release is made).  For my projects I call this script from the script
that tags and generates the new release (the call is made just before
the ReleaseID file is updated and the new tag is applied).  I can also
call this script directly if I want to see what would be put in the new
release, and I can use it to generate ChangeLog files for preview
releases too.

#! /bin/sh

# current level (i.e. the current release ID from the file
# "./ReleaseID") The format of the release ID is a line like "level
# 1.0.0" (or in between releases, e.g. for a preview release, it is a
# line like "level 1.0.0-Preview").
LEVEL=$(awk '/^level / {print $2;}' ReleaseID)

# previous level (i.e. previous release tag)
# Note the release tag naming convention is represented by this
# shell expression:
#       RELEASE-$(echo LEVEL | sed 's/\./_/g')
# and we assume the release level is always a three-part Dewy-decimal
# style number (e.g. "1.0.0", or for preview releases "1.0.1-Preview"
# and the latter works correctly because AWK does atoi() on expression
# terms before doing arithmetic with them).
PREVIOUS_TAG=$(awk -F . '/^3\./ {printf("RELEASE-%d_%d_%d\n", $1, $2, $3 - 
1);}' ReleaseID)

# also use the date to avoid junk from old removed files and new
# untagged files
# get that date from the last RCS Id of the ReleaseID file itself.
# (i.e. assume the ReleaseID file is tagged with the previous release-ID
# tag after it was changed to give the previous release ID value)
ODATE=$(cvs log -N -r${PREVIOUS_TAG} ReleaseID | awk '/^date:/ {print $2}')

# generate a fake module name -- the root directory of the module
# suffices for "cvs rlog" purposes...
FAKE_MODULE=$(sed -e "s|^$(< CVS/Root)/||" -e 1q CVS/Repository)

# generate a normal RCS log of all unreleased changes
# note the use of the magic "::" for the '-r' parameter
# (you could use "REV1::REV2" if you already have the 2nd tag applied)
cvs -q rlog -d">${ODATE}" -r${PREVIOUS_TAG}:: $FAKE_MODULE > RCSlog-${LEVEL}

# set the magic environment variable used by "rcs2log" when '-L' is given.
# (rcs2log really needs a '-C' option to tell it to set the CVS repository)
export pository=$(cat CVS/Repository)/

rcs2log -L RCSlog-${LEVEL} > ChangeLog-${LEVEL}

# optionally remove the intermediate RCSlog-* file....
#rm RCSlog-${LEVEL}

                                                Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <address@hidden>
Planix, Inc. <address@hidden>          Secrets of the Weird <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]