cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] Changes to ccvs/contrib/log_accum.in


From: Derek Robert Price
Subject: [Cvs-cvs] Changes to ccvs/contrib/log_accum.in
Date: Thu, 06 Oct 2005 14:25:04 -0400

Index: ccvs/contrib/log_accum.in
diff -u ccvs/contrib/log_accum.in:1.13 ccvs/contrib/log_accum.in:1.14
--- ccvs/contrib/log_accum.in:1.13      Thu Oct  6 17:03:42 2005
+++ ccvs/contrib/log_accum.in   Thu Oct  6 18:24:58 2005
@@ -125,11 +125,8 @@
 $BRANCH_FILE   = "$TMPDIR/${FILE_PREFIX}files.branch";
 $SUMMARY_FILE  = "$TMPDIR/${FILE_PREFIX}files.summary";
 
-$CVSROOT       = $ENV{'CVSROOT'};
-
 $MAIL_CMD      = "| /usr/lib/sendmail -i -t";
 #$MAIL_CMD      = "| /var/qmail/bin/qmail-inject";
-$MAIL_FROM     = 'commitlogger';  #not needed if EMULATE_LOCAL_MAIL_USER
 $SUBJECT_PRE   = 'CVS update:';
 
 
@@ -266,8 +263,7 @@
 #
 sub change_summary {
     local($out, @filenames) = @_;
-    local(@revline);
-    local($file, $rev, $rcsfile, $line, $vhost, $cvsweb_base);
+    local($file, $rcsfile, $line, $vhost, $cvsweb_base);
 
     while (@filenames) {
         $file = shift @filenames;
@@ -276,28 +272,12 @@
             next;
         }
 
-        open(RCS, "-|") || exec "$cvsbin/cvs", '-Qn', 'status', '--', $file;
-
-        $rev = "";
         $delta = "";
-        $rcsfile = "";
-
-
-        while (<RCS>) {
-            if (/^[ \t]*Repository revision/) {
-                chomp;
-                @revline = split(' ', $_);
-                $rev = $revline[2];
-                $rcsfile = $revline[3];
-                $rcsfile =~ s,^$CVSROOT/,,;
-                $rcsfile =~ s/,v$//;
-            }
-        }
-        close(RCS);
-
+        $rcsfile = "$update_dir/$file";
 
-        if ($rev ne '' && $rcsfile ne '') {
-            open(RCS, "-|") || exec "$cvsbin/cvs", '-Qn', 'log', "-r$rev",
+        if ($oldrev{$file} ne 'NONE') {
+            open(RCS, "-|") || exec "$cvsbin/cvs", '-Qn', 'log',
+                                   "-r$newrev{$file}",
                                    '--', $file;
             while (<RCS>) {
                 if (/^date:.*lines:([^;]+);.*/) {
@@ -328,7 +308,8 @@
         #
         if (($file =~ /\.(?:pdf|gif|jpg|mpg)$/i) || (-B $file)) {
           if ($SEND_URL eq "true") {
-            $diff .= "?rev=$rev&content-type=text/x-cvsweb-markup\n\n";
+            $diff .= "?rev=" . $newrev{$file};
+           $diff .= "&content-type=text/x-cvsweb-markup\n\n";
           }
           if ($SEND_DIFF eq "true") {
             $diff .= "\t<<Binary file>>\n\n";
@@ -340,48 +321,32 @@
             # being aware that new files always have revision '1.1' and
             # new branches always end in '.n.1'.
             #
-            if ($rev =~ /^(.*)\.([0-9]+)$/) {
-                $prev = $2 - 1;
-                $prev_rev = $1 . '.' .  $prev;
-
-                $prev_rev =~ s/\.[0-9]+\.0$//;# Truncate if first rev on branch
-
-                if ($rev eq '1.1') {
-                  if ($SEND_URL eq "true") {
-                    $diff .= "?rev=$rev&content-type=text/x-cvsweb-markup\n\n";
-                  }
-                  if ($SEND_DIFF eq "true") {
-                    open(DIFF, "-|")
-                      || exec "$cvsbin/cvs", '-Qn', 'update', '-p', '-r1.1',
-                             '--', $file;
-                    $diff .= "Index: $file\n=================================="
-                      . "=================================\n";
-                  }
-                }
-                else {
-                  if ($SEND_URL eq "true") {
-                    $diff .= ".diff?r1=$prev_rev&r2=$rev\n\n";
-                  }
-                  if ($SEND_DIFF eq "true") {
-                    $diff .= "(In the diff below, changes in quantity "
-                      . "of whitespace are not shown.)\n\n";
-                    open(DIFF, "-|")
-                      || exec "$cvsbin/cvs", '-Qn', 'diff', "$difftype",
-                      '-b', "-r$prev_rev", "-r$rev", '--', $file;
-                  }
-                }
+            if ($SEND_URL eq "true") {
+              if (!$oldrev{$file} || !$newrev{$file}) {
+                $diff .= "?rev=" . $oldrev{$file};
+               $diff .= "&content-type=text/x-cvsweb-markup\n\n";
+              } else {
+                $diff .= ".diff?r1=$oldrev{$file}&r2=$newrev{$file}\n\n";
+              }
+           }
 
-                if ($SEND_DIFF eq "true") {
-                  while (<DIFF>) {
-                    $diff .= $_;
-                  }
-                  close(DIFF);
-                }
-                $diff .= "\n\n";
-            }
+            if ($SEND_DIFF eq "true") {
+              $diff .= "(In the diff below, changes in quantity "
+                    . "of whitespace are not shown.)\n\n";
+              open(DIFF, "-|")
+                || exec "$cvsbin/cvs", '-Qn', 'diff', "$difftype",
+                '-b', "-r$oldrev{$file}", "-r$newrev{$file}", '--', $file;
+
+              while (<DIFF>) {
+                $diff .= $_;
+              }
+              close(DIFF);
+
+              $diff .= "\n\n";
+           }
         }
 
-        &append_line($out, sprintf("%-9s%-12s%s%s", $rev, $delta,
+        &append_line($out, sprintf("%-9s%-12s%s%s", $newrev{$file}, $delta,
                                    $rcsfile, $diff));
     }
 }
@@ -482,24 +447,27 @@
 sub mail_notification
 {
     local($addr_list, @text) = @_;
-    local($mail_to);
+    local ($mail_to, $mail_from);
 
     my $subj = &derive_subject_from_changes_file ();
 
-    if ($EMULATE_LOCAL_MAIL_USER ne "") {
-        $MAIL_FROM = "address@hidden";
+    if ($EMULATE_LOCAL_MAIL_USER) {
+      $mail_from = "address@hidden";
+    } else {
+      $mail_from = "$cvs_user\@" . `hostname`;
+      chomp $mail_from;
     }
 
     $mail_to = join(", ", @{$addr_list});
 
-    print "Mailing the commit message to $mail_to (from $MAIL_FROM)\n";
+    print "Mailing the commit message to $mail_to (from $mail_from)\n";
 
-    $ENV{'MAILUSER'} = $MAIL_FROM;
+    $ENV{'MAILUSER'} = $mail_from;
     # Commented out on hocus, so comment it out here.  -kff
     # $ENV{'QMAILINJECT'} = 'f';
 
-    open(MAIL, "$MAIL_CMD -f$MAIL_FROM");
-    print MAIL "From: $MAIL_FROM\n";
+    open(MAIL, "$MAIL_CMD -f$mail_from");
+    print MAIL "From: $mail_from\n";
     print MAIL "To: $mail_to\n";
     print MAIL "Subject: $SUBJECT_PRE $subj\n\n";
     print(MAIL join("\n", @text));
@@ -539,6 +507,8 @@
            $cvs_user = shift @argv;
        } elsif ($arg eq '-m') {
            push @mailto, split (/[ ,]+/, shift @argv);
+       } elsif ($arg eq '-p') {
+           $update_dir = shift @argv;
        } elsif ($arg eq '-r') {
            $have_r_opt = 1;
            $onlytag = shift @argv;
@@ -550,9 +520,25 @@
                $new_directory = 1;
            } elsif ($arg eq '- Imported sources') {
                $imported_sources = 1;
+           } elsif ($UseNewInfoFmtStrings) {
+               push @file, $arg;
+               $oldrev{$arg} = shift @argv
+                   or die "Not enough modifiers for $arg";
+               $newrev{$arg} = shift @argv
+                   or die "Not enough modifiers for $arg";
+               $oldrev{$arg} = 0 if $oldrev{$arg} eq "NONE";
+               $newrev{$arg} = 0 if $newrev{$arg} eq "NONE";
            } else {
-               push @files, ($UseNewInfoFmtStrings
-                             ? $arg : split (' ', $arg));
+               push @files, split (' ', $arg);
+               for (@files)
+               {
+                   s/,([^,]+),([^,]+)$//
+                       or die "Not enough modifiers for $_";
+                   $oldrev{$_} = $1;
+                   $newrev{$_} = $2;
+                   $oldrev{$_} = 0 if $oldrev{$_} eq "NONE";
+                   $newrev{$_} = 0 if $newrev{$_} eq "NONE";
+               }
            }
        }
     }
@@ -590,6 +576,8 @@
                                # on this branch.
 $branch = "";                  # The branch being processed.
 @mailto = ();                  # Email addresses to send mail to.
+$update_dir = "";              # The relative directory in the repo the
+                               # sandbox is rooted in.
 @files = process_argv(@ARGV);
 @path = split('/', $files[0]);
 if ($#path == 0) {
@@ -598,6 +586,10 @@
     $dir = join('/', @path[1..$#path]);
 }
 
+$update_dir = `cat CVS/Repository` unless $update_dir;
+chomp $update_dir;
+die "Could not determine update dir" unless $update_dir;
+
 #print("ARGV  - ", join(":", @ARGV), "\n");
 #print("files - ", join(":", @files), "\n");
 #print("path  - ", join(":", @path), "\n");
@@ -700,7 +692,8 @@
 &append_to_file("$CHANGED_FILE.$i.$id.$cvs_user", $dir, @changed_files);
 &append_to_file("$REMOVED_FILE.$i.$id.$cvs_user", $dir, @removed_files);
 if ($rcsidinfo) {
-    &change_summary("$SUMMARY_FILE.$i.$id.$cvs_user", (@changed_files, 
@added_files));
+  &change_summary ("$SUMMARY_FILE.$i.$id.$cvs_user",
+                  (@changed_files, @added_files, @removed_files));
 }
 
 #




reply via email to

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