[PATCH] grok cvs rlog output

From: Joe Orton <jorton@redhat.com>
Date: Fri Mar 14 2003 - 16:45:55 GMT

Hi, this patch adds an --rcs option as suggested in the BUGS file, which
allows cvs2cl to be used like

   cvs -d /foo rlog bar | cvs2cl --stdin --rcs /foo

to generate ChangeLogs without needing a working copy.

High praise for cvs2cl and its --xml output, many thanks for this tool!
Using this and some XSLT I implemented a trivial tweak to viewcvs which
lets me go from a revision of a particular file to the commit message
and a list of all the other files changed in that commit, all in single
click in my web browser, saving me hours trawling through mailing list
archives to do the same thing.

Regards,

joe

Index: cvs2cl.pl
===================================================================
RCS file: /usr/local/cvs/cvs2cl/cvs2cl.pl,v
retrieving revision 2.47
diff -u -r2.47 cvs2cl.pl
--- cvs2cl.pl 10 Mar 2003 16:08:30 -0000 2.47
+++ cvs2cl.pl 14 Mar 2003 16:35:02 -0000
@@ -210,6 +210,11 @@
 my $Delta_From = "";
 my $Delta_To = "";
 
+# Whether to parse filenames from the RCS filename, and if so what
+# prefix to strip.
+my $RCS_Mode = 0;
+my $RCS_Root = "";
+
 ## end vars set by options.
 
 # latest observed times for the start/end tags in delta mode
@@ -321,11 +327,22 @@
   {
     # Canonicalize line endings
     s/\r$//;
+ my $new_full_path;
+
     # If on a new file and don't see filename, skip until we find it, and
     # when we find it, grab it.
- if ((! (defined $file_full_path)) and /^Working file: (.*)/)
+ if (! (defined $file_full_path))
     {
- $file_full_path = $1;
+ if (/^Working file: (.*)/) {
+ $new_full_path = $1;
+ } elsif ($RCS_Mode && m|^RCS file: $RCS_Root/(.*),v$|) {
+ $new_full_path = $1;
+ }
+ }
+
+ if (defined $new_full_path)
+ {
+ $file_full_path = $new_full_path;
       if (@Ignore_Files)
       {
         my $base;
@@ -1707,6 +1724,11 @@
       $Show_Times = 0;
       $Common_Dir = 0;
     }
+ elsif ($arg =~ /^--rcs/) {
+ my $narg = shift (@ARGV) || die "$arg needs argument.\n";
+ $RCS_Root = $narg;
+ $RCS_Mode = 1;
+ }
     elsif ($arg =~ /^-U$|^--usermap$/) {
       my $narg = shift (@ARGV) || die "$arg needs argument.\n";
       $User_Map_File = $narg;
@@ -1961,6 +1983,9 @@
   --xml-encoding ENCODING Insert encoding clause in XML header
   --hide-filenames Don't show filenames (ignored for XML output)
   --no-common-dir Don't shorten directory names from filenames.
+ --rcs CVSROOT Handle filenames from raw RCS, for instance
+ those produced by "cvs rlog" output, stripping
+ the prefix CVSROOT.
   -P, --prune Don't show empty log messages
   --ignore-tag TAG Ignore individual changes that are associated
                                with a given tag. May be repeated, if so,
Received on Mon Mar 17 09:50:24 2003

This archive was generated by hypermail 2.1.8 : Wed Jan 21 2004 - 16:25:34 GMT