From 0777097525cdaf5609b790e848fe5acaf5a87cbc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Mon, 10 Oct 2011 11:50:08 +0000 Subject: [PATCH] Process CVS logs file by file to pre-fill the ChangeLog before editing --- org.glite.lb/etics-tag.pl | 52 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/org.glite.lb/etics-tag.pl b/org.glite.lb/etics-tag.pl index 9c05576..854951a 100755 --- a/org.glite.lb/etics-tag.pl +++ b/org.glite.lb/etics-tag.pl @@ -24,6 +24,56 @@ $GLITE_LB_LOCATION="./org.glite.lb"; if ($TMPDIR eq "") {$TMPDIR="/tmp";} +sub ConstructChangeLog { + my ($CCLtag,$CCLmod,$CCLchl) = @_; + my $orig_tag = ""; + my $new_tag = ""; + my $filename = ""; + + open(CHANGELOG, ">>$CCLchl"); + + + open(CCLFILES, "cvs diff -r $CCLtag $CCLmod | grep -E '^RCS file' -A 2 | "); + while () { + $inline=$_; + chomp($inline); + + if($inline =~/^RCS file: \/cvs\/.*?\/(.*),.*$/) { + $filename=$1; + $orig_tag=""; + $new_tag=""; + } + if ($inline =~/^retrieving revision ([0-9\.]*)/) { + if ($orig_tag == "") { + $orig_tag=$1; + } + else { + $new_tag=$1; + + open(OUTLINES, "cvs log -S -N -r" . "$orig_tag" . "::$new_tag $filename | egrep -v \"^locks:|^access list:|^keyword substitution:|^total revisions:|^branch:|^description:|^head:|^RCS file:|^---|^===|^revision|^Working[ ]file: \" |"); + $CCLnames = ""; + while () { + $logline=$_; + chomp($logline); + if ($logline=~/^date:.*author:\s+(.*?);\s+state.*/) { + unless ($CCLnames=~/$1/) { + $CCLnames = $CCLnames . ", $1"; + } + } + else { + print CHANGELOG "$_"; + } + } + print CHANGELOG " ==$filename $orig_tag to $new_tag$CCLnames=="; + close(OUTLINES); + } + } + } + close(CCLFILES); + close(CHANGELOG); + +} + getopts('i:c:m:p:gh'); $module = shift; @@ -228,7 +278,7 @@ usage: $0 [-i maj|min|rev|age|none|] [-g] [-c > $tmpChangeLog"); system("echo \"\" >> $tmpChangeLog");} - else { system("cvs log -S -N -r" . "$current_tag" . ":: $module | egrep -v \"^locks:|^access list:|^keyword substitution:|^total revisions:|^branch:|^description:|^head:|^RCS file:|^date:|^---|^===|^revision \" >> $tmpChangeLog"); } + else { ConstructChangeLog($current_tag, $module, $tmpChangeLog); } $ChangeLogRet=system("vim +$editline -c \"norm z.\" $tmpChangeLog"); } -- 1.8.2.3