125 |
$BRANCH_FILE = "$TMPDIR/${FILE_PREFIX}files.branch"; |
$BRANCH_FILE = "$TMPDIR/${FILE_PREFIX}files.branch"; |
126 |
$SUMMARY_FILE = "$TMPDIR/${FILE_PREFIX}files.summary"; |
$SUMMARY_FILE = "$TMPDIR/${FILE_PREFIX}files.summary"; |
127 |
|
|
|
$CVSROOT = $ENV{'CVSROOT'}; |
|
|
|
|
128 |
$MAIL_CMD = "| /usr/lib/sendmail -i -t"; |
$MAIL_CMD = "| /usr/lib/sendmail -i -t"; |
129 |
#$MAIL_CMD = "| /var/qmail/bin/qmail-inject"; |
#$MAIL_CMD = "| /var/qmail/bin/qmail-inject"; |
|
$MAIL_FROM = 'commitlogger'; #not needed if EMULATE_LOCAL_MAIL_USER |
|
130 |
$SUBJECT_PRE = 'CVS update:'; |
$SUBJECT_PRE = 'CVS update:'; |
131 |
|
|
132 |
|
|
263 |
# |
# |
264 |
sub change_summary { |
sub change_summary { |
265 |
local($out, @filenames) = @_; |
local($out, @filenames) = @_; |
266 |
local(@revline); |
local($file, $rcsfile, $line, $vhost, $cvsweb_base); |
|
local($file, $rev, $rcsfile, $line, $vhost, $cvsweb_base); |
|
267 |
|
|
268 |
while (@filenames) { |
while (@filenames) { |
269 |
$file = shift @filenames; |
$file = shift @filenames; |
272 |
next; |
next; |
273 |
} |
} |
274 |
|
|
|
open(RCS, "-|") || exec "$cvsbin/cvs", '-Qn', 'status', '--', $file; |
|
|
|
|
|
$rev = ""; |
|
275 |
$delta = ""; |
$delta = ""; |
276 |
$rcsfile = ""; |
$rcsfile = "$update_dir/$file"; |
|
|
|
|
|
|
|
while (<RCS>) { |
|
|
if (/^[ \t]*Repository revision/) { |
|
|
chomp; |
|
|
@revline = split(' ', $_); |
|
|
$rev = $revline[2]; |
|
|
$rcsfile = $revline[3]; |
|
|
$rcsfile =~ s,^$CVSROOT/,,; |
|
|
$rcsfile =~ s/,v$//; |
|
|
} |
|
|
} |
|
|
close(RCS); |
|
|
|
|
277 |
|
|
278 |
if ($rev ne '' && $rcsfile ne '') { |
if ($oldrev{$file} ne 'NONE') { |
279 |
open(RCS, "-|") || exec "$cvsbin/cvs", '-Qn', 'log', "-r$rev", |
open(RCS, "-|") || exec "$cvsbin/cvs", '-Qn', 'log', |
280 |
|
"-r$newrev{$file}", |
281 |
'--', $file; |
'--', $file; |
282 |
while (<RCS>) { |
while (<RCS>) { |
283 |
if (/^date:.*lines:([^;]+);.*/) { |
if (/^date:.*lines:([^;]+);.*/) { |
308 |
# |
# |
309 |
if (($file =~ /\.(?:pdf|gif|jpg|mpg)$/i) || (-B $file)) { |
if (($file =~ /\.(?:pdf|gif|jpg|mpg)$/i) || (-B $file)) { |
310 |
if ($SEND_URL eq "true") { |
if ($SEND_URL eq "true") { |
311 |
$diff .= "?rev=$rev&content-type=text/x-cvsweb-markup\n\n"; |
$diff .= "?rev=" . $newrev{$file}; |
312 |
|
$diff .= "&content-type=text/x-cvsweb-markup\n\n"; |
313 |
} |
} |
314 |
if ($SEND_DIFF eq "true") { |
if ($SEND_DIFF eq "true") { |
315 |
$diff .= "\t<<Binary file>>\n\n"; |
$diff .= "\t<<Binary file>>\n\n"; |
321 |
# being aware that new files always have revision '1.1' and |
# being aware that new files always have revision '1.1' and |
322 |
# new branches always end in '.n.1'. |
# new branches always end in '.n.1'. |
323 |
# |
# |
324 |
if ($rev =~ /^(.*)\.([0-9]+)$/) { |
if ($SEND_URL eq "true") { |
325 |
$prev = $2 - 1; |
if (!$oldrev{$file} || !$newrev{$file}) { |
326 |
$prev_rev = $1 . '.' . $prev; |
$diff .= "?rev=" . $oldrev{$file}; |
327 |
|
$diff .= "&content-type=text/x-cvsweb-markup\n\n"; |
328 |
$prev_rev =~ s/\.[0-9]+\.0$//;# Truncate if first rev on branch |
} else { |
329 |
|
$diff .= ".diff?r1=$oldrev{$file}&r2=$newrev{$file}\n\n"; |
330 |
if ($rev eq '1.1') { |
} |
331 |
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; |
|
|
} |
|
|
} |
|
332 |
|
|
333 |
if ($SEND_DIFF eq "true") { |
if ($SEND_DIFF eq "true") { |
334 |
while (<DIFF>) { |
$diff .= "(In the diff below, changes in quantity " |
335 |
$diff .= $_; |
. "of whitespace are not shown.)\n\n"; |
336 |
} |
open(DIFF, "-|") |
337 |
close(DIFF); |
|| exec "$cvsbin/cvs", '-Qn', 'diff', "$difftype", |
338 |
} |
'-b', "-r$oldrev{$file}", "-r$newrev{$file}", '--', $file; |
339 |
$diff .= "\n\n"; |
|
340 |
} |
while (<DIFF>) { |
341 |
|
$diff .= $_; |
342 |
|
} |
343 |
|
close(DIFF); |
344 |
|
|
345 |
|
$diff .= "\n\n"; |
346 |
|
} |
347 |
} |
} |
348 |
|
|
349 |
&append_line($out, sprintf("%-9s%-12s%s%s", $rev, $delta, |
&append_line($out, sprintf("%-9s%-12s%s%s", $newrev{$file}, $delta, |
350 |
$rcsfile, $diff)); |
$rcsfile, $diff)); |
351 |
} |
} |
352 |
} |
} |
447 |
sub mail_notification |
sub mail_notification |
448 |
{ |
{ |
449 |
local($addr_list, @text) = @_; |
local($addr_list, @text) = @_; |
450 |
local($mail_to); |
local ($mail_to, $mail_from); |
451 |
|
|
452 |
my $subj = &derive_subject_from_changes_file (); |
my $subj = &derive_subject_from_changes_file (); |
453 |
|
|
454 |
if ($EMULATE_LOCAL_MAIL_USER ne "") { |
if ($EMULATE_LOCAL_MAIL_USER) { |
455 |
$MAIL_FROM = "$cvs_user\@$EMULATE_LOCAL_MAIL_USER"; |
$mail_from = "$cvs_user\@$EMULATE_LOCAL_MAIL_USER"; |
456 |
|
} else { |
457 |
|
$mail_from = "$cvs_user\@" . `hostname`; |
458 |
|
chomp $mail_from; |
459 |
} |
} |
460 |
|
|
461 |
$mail_to = join(", ", @{$addr_list}); |
$mail_to = join(", ", @{$addr_list}); |
462 |
|
|
463 |
print "Mailing the commit message to $mail_to (from $MAIL_FROM)\n"; |
print "Mailing the commit message to $mail_to (from $mail_from)\n"; |
464 |
|
|
465 |
$ENV{'MAILUSER'} = $MAIL_FROM; |
$ENV{'MAILUSER'} = $mail_from; |
466 |
# Commented out on hocus, so comment it out here. -kff |
# Commented out on hocus, so comment it out here. -kff |
467 |
# $ENV{'QMAILINJECT'} = 'f'; |
# $ENV{'QMAILINJECT'} = 'f'; |
468 |
|
|
469 |
open(MAIL, "$MAIL_CMD -f$MAIL_FROM"); |
open(MAIL, "$MAIL_CMD -f$mail_from"); |
470 |
print MAIL "From: $MAIL_FROM\n"; |
print MAIL "From: $mail_from\n"; |
471 |
print MAIL "To: $mail_to\n"; |
print MAIL "To: $mail_to\n"; |
472 |
print MAIL "Subject: $SUBJECT_PRE $subj\n\n"; |
print MAIL "Subject: $SUBJECT_PRE $subj\n\n"; |
473 |
print(MAIL join("\n", @text)); |
print(MAIL join("\n", @text)); |
507 |
$cvs_user = shift @argv; |
$cvs_user = shift @argv; |
508 |
} elsif ($arg eq '-m') { |
} elsif ($arg eq '-m') { |
509 |
push @mailto, split (/[ ,]+/, shift @argv); |
push @mailto, split (/[ ,]+/, shift @argv); |
510 |
|
} elsif ($arg eq '-p') { |
511 |
|
$update_dir = shift @argv; |
512 |
} elsif ($arg eq '-r') { |
} elsif ($arg eq '-r') { |
513 |
$have_r_opt = 1; |
$have_r_opt = 1; |
514 |
$onlytag = shift @argv; |
$onlytag = shift @argv; |
520 |
$new_directory = 1; |
$new_directory = 1; |
521 |
} elsif ($arg eq '- Imported sources') { |
} elsif ($arg eq '- Imported sources') { |
522 |
$imported_sources = 1; |
$imported_sources = 1; |
523 |
|
} elsif ($UseNewInfoFmtStrings) { |
524 |
|
push @file, $arg; |
525 |
|
$oldrev{$arg} = shift @argv |
526 |
|
or die "Not enough modifiers for $arg"; |
527 |
|
$newrev{$arg} = shift @argv |
528 |
|
or die "Not enough modifiers for $arg"; |
529 |
|
$oldrev{$arg} = 0 if $oldrev{$arg} eq "NONE"; |
530 |
|
$newrev{$arg} = 0 if $newrev{$arg} eq "NONE"; |
531 |
} else { |
} else { |
532 |
push @files, ($UseNewInfoFmtStrings |
push @files, split (' ', $arg); |
533 |
? $arg : split (' ', $arg)); |
for (@files) |
534 |
|
{ |
535 |
|
s/,([^,]+),([^,]+)$// |
536 |
|
or die "Not enough modifiers for $_"; |
537 |
|
$oldrev{$_} = $1; |
538 |
|
$newrev{$_} = $2; |
539 |
|
$oldrev{$_} = 0 if $oldrev{$_} eq "NONE"; |
540 |
|
$newrev{$_} = 0 if $newrev{$_} eq "NONE"; |
541 |
|
} |
542 |
} |
} |
543 |
} |
} |
544 |
} |
} |
576 |
# on this branch. |
# on this branch. |
577 |
$branch = ""; # The branch being processed. |
$branch = ""; # The branch being processed. |
578 |
@mailto = (); # Email addresses to send mail to. |
@mailto = (); # Email addresses to send mail to. |
579 |
|
$update_dir = ""; # The relative directory in the repo the |
580 |
|
# sandbox is rooted in. |
581 |
@files = process_argv(@ARGV); |
@files = process_argv(@ARGV); |
582 |
@path = split('/', $files[0]); |
@path = split('/', $files[0]); |
583 |
if ($#path == 0) { |
if ($#path == 0) { |
586 |
$dir = join('/', @path[1..$#path]); |
$dir = join('/', @path[1..$#path]); |
587 |
} |
} |
588 |
|
|
589 |
|
$update_dir = `cat CVS/Repository` unless $update_dir; |
590 |
|
chomp $update_dir; |
591 |
|
die "Could not determine update dir" unless $update_dir; |
592 |
|
|
593 |
#print("ARGV - ", join(":", @ARGV), "\n"); |
#print("ARGV - ", join(":", @ARGV), "\n"); |
594 |
#print("files - ", join(":", @files), "\n"); |
#print("files - ", join(":", @files), "\n"); |
595 |
#print("path - ", join(":", @path), "\n"); |
#print("path - ", join(":", @path), "\n"); |
692 |
&append_to_file("$CHANGED_FILE.$i.$id.$cvs_user", $dir, @changed_files); |
&append_to_file("$CHANGED_FILE.$i.$id.$cvs_user", $dir, @changed_files); |
693 |
&append_to_file("$REMOVED_FILE.$i.$id.$cvs_user", $dir, @removed_files); |
&append_to_file("$REMOVED_FILE.$i.$id.$cvs_user", $dir, @removed_files); |
694 |
if ($rcsidinfo) { |
if ($rcsidinfo) { |
695 |
&change_summary("$SUMMARY_FILE.$i.$id.$cvs_user", (@changed_files, @added_files)); |
&change_summary ("$SUMMARY_FILE.$i.$id.$cvs_user", |
696 |
|
(@changed_files, @added_files, @removed_files)); |
697 |
} |
} |
698 |
|
|
699 |
# |
# |