a loginfo/log_accum/commitprep script for cvs to email commit logs and diffs upon commits
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add a -D option to just print the cvs diff commands, as opposed to including the actual diffs with -d

from Damien Miller <djm@mindrot.org>

jcs 5d42fa8f 5b9c3be0

+23 -12
+23 -12
loginfo.pl
··· 1 1 #!/usr/bin/perl 2 - # $Id: loginfo.pl,v 1.18 2005/12/18 03:31:45 jcs Exp $ 2 + # $Id: loginfo.pl,v 1.19 2007/01/05 06:18:47 jcs Exp $ 3 3 # vim:ts=4 4 4 # 5 5 # loginfo.pl ··· 7 7 # the log_accum script included with cvs, but not nearly as hideous. also 8 8 # supports emailing diffs. 9 9 # 10 - # Copyright (c) 2004-2005 joshua stein <jcs@jcs.org> 10 + # Copyright (c) 2004-2007 joshua stein <jcs@jcs.org> 11 11 # 12 12 # Redistribution and use in source and binary forms, with or without 13 13 # modification, are permitted provided that the following conditions ··· 46 46 use strict; 47 47 48 48 # bucket o' variables 49 - my ($changelog, $dodiffs, $donewdir, $doimport, @emailrecips); 49 + my ($changelog, $dodiffs, $dordiffcmds, $donewdir, $doimport, @emailrecips); 50 50 my ($curdir, $prepdir, $lastdir, $module, $branch); 51 51 my (@diffcmds, %modfiles, %addfiles, %delfiles, @message, @log); 52 52 ··· 77 77 shift(@ARGV); 78 78 } elsif ($ARGV[0] eq "-d") { 79 79 $dodiffs = 1; 80 + # no args 81 + } elsif ($ARGV[0] eq "-D") { 82 + $dordiffcmds = 1; 80 83 # no args 81 84 } elsif ($ARGV[0] eq "-m") { 82 85 push @emailrecips, $ARGV[1]; ··· 310 313 close(CHANGELOG); 311 314 } 312 315 313 - if (($donewdir eq "") and ($dodiffs) and (-f $tmpdir . "/" . $tmp_diffcmd)) { 316 + if (($donewdir eq "") and ($dodiffs or $dordiffcmds) and 317 + (-f $tmpdir . "/" . $tmp_diffcmd)) { 314 318 # generate diffs 315 319 @diffcmds = (); 316 320 open(DIFFCMDS, "<" . $tmpdir . "/" . $tmp_diffcmd) or ··· 321 325 close(DIFFCMDS); 322 326 323 327 if ($#diffcmds > -1) { 324 - push @message, "\n"; 325 - push @message, "Diffs:\n"; 328 + if ($dordiffcmds) { 329 + push @message, "\n"; 330 + push @message, "Diff commands:\n"; 331 + push @message, join("\n", @diffcmds) . "\n"; 332 + } 333 + if ($dodiffs) { 334 + push @message, "\n"; 335 + push @message, "Diffs:\n"; 326 336 327 - foreach my $diffcmd (@diffcmds) { 328 - my @args = split(" ", $diffcmd, 7); 329 - open(DIFF, "-|") || exec @args; 330 - while (my $line = <DIFF>) { 331 - push @message, $line; 337 + foreach my $diffcmd (@diffcmds) { 338 + my @args = split(" ", $diffcmd, 7); 339 + open(DIFF, "-|") || exec @args; 340 + while (my $line = <DIFF>) { 341 + push @message, $line; 342 + } 343 + close(DIFF); 332 344 } 333 - close(DIFF); 334 345 } 335 346 } 336 347 }