CVSROOT: logdiff.pl - try to support old and new args

qboosh qboosh at pld-linux.org
Tue Nov 6 01:06:20 CET 2007


Author: qboosh                       Date: Tue Nov  6 00:06:20 2007 GMT
Module: CVSROOT                       Tag: HEAD
---- Log message:
- try to support old and new args

---- Files affected:
CVSROOT:
   logdiff.pl (1.43 -> 1.44) 

---- Diffs:

================================================================
Index: CVSROOT/logdiff.pl
diff -u CVSROOT/logdiff.pl:1.43 CVSROOT/logdiff.pl:1.44
--- CVSROOT/logdiff.pl:1.43	Mon Nov  5 23:10:36 2007
+++ CVSROOT/logdiff.pl	Tue Nov  6 01:06:15 2007
@@ -250,18 +250,23 @@
     }
     else
     {
-        ($donefiles) && die("Too many arguments (extra $arg)! Check usage.\n");
-	    $donefiles = 1;
-	    @files = split(/ /, $arg);
-	    @ARGVX = $arg;
+        last;
     }
 }
 
-## for now, the first "file" is the repository directory being committed,
-## relative to the $CVSROOT location
-##
- at path = split('/', $files[0]);
- at files1 = @files;
+if(@ARGV == 1) {
+    # single arg, assume the old way ("PATH {FILE,rev1,rev2 }+")
+    @ARGVX = shift @ARGV;
+    @files1 = split(/ /, $ARGVX[0]);
+    @path = split('/', shift @files1);
+    $oldstyle = 1;
+} else {
+    # assume the new way ("PATH" {"FILE" "rev1" "rev2"}+)
+    @path = split('/', shift @ARGV);
+    @ARGVX = @ARGV[0];
+    @files1 = @ARGV;
+    $oldstyle = 0;
+}
 
 ## XXX there are some ugly assumptions in here about module names and
 ## XXX directories relative to the $CVSROOT location -- really should
@@ -454,18 +459,24 @@
 
 $references = "";
 
-$file = shift @files1;
 $subject = "$modulename:";
 $file_no = 0;
 while (@files1)
 {
-    $file = shift @files1;
+    if($oldstyle) {
+        $file = shift @files1;
 
-    @file_split = split(/\,/, $file);
-    
-    $filename = "$file_split[0]";
-    $rev1 = "$file_split[1]";
-    $rev2 = "$file_split[2]";
+        # should be rsplit...
+        @file_split = split(/\,/, $file, 3);
+        
+        $filename = "$file_split[0]";
+        $rev1 = "$file_split[1]";
+        $rev2 = "$file_split[2]";
+    } else {
+        $filename = shift @files1;
+        $rev1 = shift @files1;
+        $rev2 = shift @files1;
+    }
 
     $subject = $subject . " $filename";
     
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/CVSROOT/logdiff.pl?r1=1.43&r2=1.44&f=u



More information about the pld-cvs-commit mailing list