Re: ChangeLogging commits to CVS
Felix Kühling <[email protected]>
| Newsgroups | gmane.comp.freedesktop.release-wranglers,gmane.comp.freedesktop.xorg |
|---|---|
| Message-ID | <1103057733.4020.3.camel@trabant> |
Sorry, I screwed up the patch. Here is the real one. -- | Felix Kühling <[email protected]> http://fxk.de.vu | | PGP Fingerprint: 6A3C 9566 5B30 DDED 73C3 B152 151C 5CC1 D888 E595 | _______________________________________________ release-wranglers mailing list release-wranglers-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/release-wranglers
prepare-ChangeLog.pl.diff
(text/x-patch, 2.1 KB)
--- prepare-ChangeLog.pl.orig 2004-12-14 13:57:02.000000000 +0100
+++ prepare-ChangeLog.pl 2004-12-14 18:21:37.000000000 +0100
@@ -42,12 +42,54 @@
use English;
use Text::Wrap;
+# Parse command line arguments.
+my $cvsOpts = "";
+my $cvsOptsDone = 0;
+my @changedFiles;
+while (my $arg = shift @ARGV) {
+ if (!$cvsOptsDone) {
+ if ($arg eq "--") {
+ $cvsOptsDone = 1;
+ } elsif ($arg =~ /-.*/) {
+ $cvsOpts .= " $arg";
+ } else {
+ $cvsOptsDone = 1;
+ push @changedFiles, $arg;
+ }
+ } else {
+ push @changedFiles, $arg;
+ }
+}
+
+# Find a ChangeLog file in upper directories. Go there.
+chomp(my $wd = `pwd`);
+my $prefix = "";
+until (-f "ChangeLog" || $wd eq "") {
+ $wd =~ m-^(.*)/([^/]*)$-;
+ $wd = $1;
+ $prefix = "$2/$prefix";
+ chdir $wd unless $wd eq "";
+}
+
+die "No ChangeLog found in upper directories." if ($wd eq "");
+print STDERR "Found ChangeLog file in $wd.\n";
+
+# Prefix all files with relative paths with $prefix. Build a String.
+my $changedFiles = "";
+foreach my $file (@changedFiles) {
+ $file = $prefix . $file unless ($file =~ m-^/-);
+ $changedFiles .= " $file";
+}
+
+# If no files are listed on the commane line then diff the whole directory.
+$changedFiles = " $prefix" if $changedFiles eq "" && $prefix ne "";
+
# For each file, build a list of modified lines.
# Use line numbers from the "after" side of each diff.
print STDERR " Running cvs diff to find changes.\n";
my %changed_line_ranges;
my $file;
-open DIFF, "cvs -fq diff -N |" or die "The cvs diff failed: $OS_ERROR.\n";
+open DIFF, "cvs -fq$cvsOpts diff -N$changedFiles |" or die "The cvs diff failed: $OS_ERROR.\n";
while (<DIFF>)
{
$file = $1 if /^Index: (\S+)$/;
@@ -166,7 +208,7 @@
if ($logs)
{
print STDERR " Updating ChangeLog files from cvs repository.\n";
- open ERRORS, "cvs update$logs |" or die "The cvs update of ChangeLog files failed: $OS_ERROR.\n";
+ open ERRORS, "cvs$cvsOpts update$logs |" or die "The cvs update of ChangeLog files failed: $OS_ERROR.\n";
print STDERR " $ARG" while <ERRORS>;
close ERRORS;
}