Re: Adding diffs to commit-mail on the fly
On Sat, Jun 01, 2002 at 04:17:54AM +0300, Giorgos Keramidas wrote: > The idea was resting at the back of my mind, and tonight I hacked this > Perl script that seems to mostly do what I want, when I pipe a single There's is also the `cvsmail' port that does that. :0 bf * ^Sender:.*owner-(freebsd-)?cvs-(committers|all)@.*FreeBSD.ORG | cvsmail To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
: :Hi Matt and everyone, : :I remember that Matt had mentioned adding diffs of the commits to the :commit-mail, which would make it possible to quickly view what changed :without leaving the MUA and manually searching for the proper CVS :diff/rdiff incantation to view the diff. : :The idea was resting at the back of my mind, and tonight I hacked this :Perl script that seems to mostly do what I want, when I pipe a single :message to it's STDIN in mbox format. Given a script in Perl or awk :... Very cool! I'm mostly unavilable for the weekend but when I get back I'll look into integrating your perl script with the filter I've been working on. The filter is mostly done but I hadn't written the part that generates the commit diff yet. You script may be just the ticket. -Matt To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On 2002-06-01 10:00 +0200, Wilko Bulte wrote: > On Sat, Jun 01, 2002 at 07:49:52AM +0300, Giorgos Keramidas wrote: > > cvs-all-diff > > committers > > Nothing changed in cvs-all, but let committers get diffs. > > I would like to be able to select the short mail as well (as a committer). > Is that reasonably feasible? After I check out the existing functionality that somehow crept in without me noticing at all. Dima Dorfman has pointed me to cfg.pm and various existing configuration options already :) I am essentially looking for a way to do this with fine-grained control, as you suggest. Say something like: [plan a] committer A wants to get diffs, but only for doc/en_US* files. committer B wants to get diffs for everything, except for src/sys/* Making this work for mailing lists too is really out of my reach for now, since I can't think of some way to make it happen *AND* allow for fine-grained control of when to put diffs in the posted message. I think that playing with the existing CVSROOT for a while and trying to make something like plan [a] above seems a nice idea. But I can't promise I'll have anything working until I read what Dima haspointed out. At least, I learned another bit of Perl last night[1] :) - Giorgos [1] Perl might be on its way out of the base, but I still like it. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On Sat, Jun 01, 2002 at 07:49:52AM +0300, Giorgos Keramidas wrote: > On 2002-05-31 20:08 -0700, Brooks Davis wrote: > > On Fri, May 31, 2002 at 09:32:26PM -0500, Brandon D. Valentine wrote: > > > On Sat, 1 Jun 2002, Giorgos Keramidas wrote: > > > >Indeed. Brain cells shutting down already. I shouldn't read procmail > > > >rules after I get sleepy. The 'f' flag of procmail seems like, aw mee > > > >gods, so fine ;-))) > > > > > > Cool. If I might make another suggestion, you will likely get faster > > > performance and in general make people happier if you only run this > > > script against your own personal mirror of the CVS repo so as not to tie > > > up anoncvs.freebsd.org. > > > > There's a rather serious problem with that idea... I'm actually not > > sure even anoncvs.freebsd.org will work since I get commit mail pretty > > close to instantly after I do a commit and I know my repository isn't up > > to date by then. I'd be slightly suprised if anoncvs.freebsd.org was > > either. > > Well, yep. I want to test this with a bunch of good ole' commits logs > first, and make sure it works as expected. Then the plan is to > integrate this to the CVSROOT scripts of FreeBSD and make sure one can > choose whether diffs are sent by something similar to CVSROOT/access. > > If that works reasonably well, then perhaps we can have the following: > > cvs-all-diff > A list like cvs-all is now, where anyone can subscribe and > receive diff output as long as normal commit logs. This has > the advantage that cvs-all remains as it is today, and those > who want to also get patches in their mailboxen unsubscribe > from cvs-all and subscribe to cvs-all-diff instead. > > committers > Nothing changed in cvs-all, but let committers get diffs. > This leaves things unchanged for cvs-all, but lets committers > receive diffs too, while everyone who is subscribed in cvs-all > continues to receive shorter mail. (Bandwidth is not cheap I would like to be able to select the short mail as well (as a committer). Is that reasonably feasible? -- | / o / /_ _ [EMAIL PROTECTED] |/|/ / / /( (_) Bulte Arnhem, the Netherlands To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On 2002-05-31 20:08 -0700, Brooks Davis wrote: > On Fri, May 31, 2002 at 09:32:26PM -0500, Brandon D. Valentine wrote: > > On Sat, 1 Jun 2002, Giorgos Keramidas wrote: > > >Indeed. Brain cells shutting down already. I shouldn't read procmail > > >rules after I get sleepy. The 'f' flag of procmail seems like, aw mee > > >gods, so fine ;-))) > > > > Cool. If I might make another suggestion, you will likely get faster > > performance and in general make people happier if you only run this > > script against your own personal mirror of the CVS repo so as not to tie > > up anoncvs.freebsd.org. > > There's a rather serious problem with that idea... I'm actually not > sure even anoncvs.freebsd.org will work since I get commit mail pretty > close to instantly after I do a commit and I know my repository isn't up > to date by then. I'd be slightly suprised if anoncvs.freebsd.org was > either. Well, yep. I want to test this with a bunch of good ole' commits logs first, and make sure it works as expected. Then the plan is to integrate this to the CVSROOT scripts of FreeBSD and make sure one can choose whether diffs are sent by something similar to CVSROOT/access. If that works reasonably well, then perhaps we can have the following: cvs-all-diff A list like cvs-all is now, where anyone can subscribe and receive diff output as long as normal commit logs. This has the advantage that cvs-all remains as it is today, and those who want to also get patches in their mailboxen unsubscribe from cvs-all and subscribe to cvs-all-diff instead. committers Nothing changed in cvs-all, but let committers get diffs. This leaves things unchanged for cvs-all, but lets committers receive diffs too, while everyone who is subscribed in cvs-all continues to receive shorter mail. (Bandwidth is not cheap for some of the subscribers of cvs-xxx lists, so making them receive patches might be an overkill.) - Giorgos To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On Fri, May 31, 2002 at 09:32:26PM -0500, Brandon D. Valentine wrote: > On Sat, 1 Jun 2002, Giorgos Keramidas wrote: > > >Indeed. Brain cells shutting down already. I shouldn't read procmail > >rules after I get sleepy. The 'f' flag of procmail seems like, aw mee > >gods, so fine ;-))) > > Cool. If I might make another suggestion, you will likely get faster > performance and in general make people happier if you only run this > script against your own personal mirror of the CVS repo so as not to tie > up anoncvs.freebsd.org. There's a rather serious problem with that idea... I'm actually not sure even anoncvs.freebsd.org will work since I get commit mail pretty close to instantly after I do a commit and I know my repository isn't up to date by then. I'd be slightly suprised if anoncvs.freebsd.org was either. -- Brooks -- Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 msg34751/pgp0.pgp Description: PGP signature
Re: Adding diffs to commit-mail on the fly
On Sat, 1 Jun 2002, Giorgos Keramidas wrote: >Indeed. Brain cells shutting down already. I shouldn't read procmail >rules after I get sleepy. The 'f' flag of procmail seems like, aw mee >gods, so fine ;-))) Cool. If I might make another suggestion, you will likely get faster performance and in general make people happier if you only run this script against your own personal mirror of the CVS repo so as not to tie up anoncvs.freebsd.org. Brandon D. Valentine -- http://www.geekpunk.net [EMAIL PROTECTED] ++[>++<-]>[<++>-]<.>[>+<-]>[<+>-]<+.+++..++ +.>>+[<++>-]<++.<<+++.>.+++.--..>+. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On 2002-05-31 21:18 -0500, Brandon D. Valentine wrote: >On Sat, 1 Jun 2002, Giorgos Keramidas wrote: >>On 2002-05-31 20:53 -0500, Brandon D. Valentine wrote: >>> Assuming your script works, here's the procmail hoodoo: >>> >>> :0 fw >>> * ^List-Id: >>> | /path/to/filter/script >> >>The problem with this is that I would have to hardwire the output >>folder name to the script, or pass it as a parameter. I've found two >>answers until now, by reading my manpages [beats head]. One is: > > Nonsense. With the rule I gave you your script should take the message > on stdin, modify it, and spit it back out on stdout where it will > continue to fall through the procmail rules. That's what the 'f' option > at the start of the rule is all about. You end up with two succesive > rules like this: > > :0 fw > * ^List-Id: > | /path/to/filter/script > > :0: > *^ List-Id: > cvs-all > > Make sense? Indeed. Brain cells shutting down already. I shouldn't read procmail rules after I get sleepy. The 'f' flag of procmail seems like, aw mee gods, so fine ;-))) - Giorgos To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On Sat, 1 Jun 2002, Giorgos Keramidas wrote: >On 2002-05-31 20:53 -0500, Brandon D. Valentine wrote: >> Assuming your script works, here's the procmail hoodoo: >> >> :0 fw >> * ^List-Id: >> | /path/to/filter/script > >The problem with this is that I would have to hardwire the output >folder name to the script, or pass it as a parameter. I've found two >answers until now, by reading my manpages [beats head]. One is: Nonsense. With the rule I gave you your script should take the message on stdin, modify it, and spit it back out on stdout where it will continue to fall through the procmail rules. That's what the 'f' option at the start of the rule is all about. You end up with two succesive rules like this: :0 fw * ^List-Id: | /path/to/filter/script :0: *^ List-Id: cvs-all Make sense? Brandon D. Valentine -- http://www.geekpunk.net [EMAIL PROTECTED] ++[>++<-]>[<++>-]<.>[>+<-]>[<+>-]<+.+++..++ +.>>+[<++>-]<++.<<+++.>.+++.--..>+. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On 2002-05-31 20:53 -0500, Brandon D. Valentine wrote: > On Sat, 1 Jun 2002, Giorgos Keramidas wrote: > > >Given a script in Perl or awk > >or whatever that works like this one, how would you all integrate this > >with procmail to let it filter all the commit mail of FreeBSD? > > Assuming your script works, here's the procmail hoodoo: > > :0 fw > * ^List-Id: > | /path/to/filter/script > > Insert this rule into your .procmailrc anywhere above where you actually > filter cvs-all to a specific folder. The problem with this is that I would have to hardwire the output folder name to the script, or pass it as a parameter. I've found two answers until now, by reading my manpages [beats head]. One is: :0 H * ^sender: [EMAIL PROTECTED] | /path/to/filter freebsd-cvs-all But 'm not sure if this will let procmail lock the folder properly. My intention was to add something like: :0 H * ^sender: [EMAIL PROTECTED] * ! ^X-inline-diff: yes | /path/to/filter | formail -I 'X-Inline-Diff: yes' -s procmail :0 H * ^sender: [EMAIL PROTECTED] freebsd-cvs-all Reading up my formail/procmail manpage helped a bit. Off to yet more testing :) - Giorgos To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Adding diffs to commit-mail on the fly
On Sat, 1 Jun 2002, Giorgos Keramidas wrote: >Given a script in Perl or awk >or whatever that works like this one, how would you all integrate this >with procmail to let it filter all the commit mail of FreeBSD? Assuming your script works, here's the procmail hoodoo: :0 fw * ^List-Id: | /path/to/filter/script Insert this rule into your .procmailrc anywhere above where you actually filter cvs-all to a specific folder. Brandon D. Valentine -- http://www.geekpunk.net [EMAIL PROTECTED] ++[>++<-]>[<++>-]<.>[>+<-]>[<+>-]<+.+++..++ +.>>+[<++>-]<++.<<+++.>.+++.--..>+. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Adding diffs to commit-mail on the fly
Hi Matt and everyone, I remember that Matt had mentioned adding diffs of the commits to the commit-mail, which would make it possible to quickly view what changed without leaving the MUA and manually searching for the proper CVS diff/rdiff incantation to view the diff. The idea was resting at the back of my mind, and tonight I hacked this Perl script that seems to mostly do what I want, when I pipe a single message to it's STDIN in mbox format. Given a script in Perl or awk or whatever that works like this one, how would you all integrate this with procmail to let it filter all the commit mail of FreeBSD? The code of the script is a bit clumsily written, but here it is for anyone who cares to play with it. You can see a sample of the output of this script, in mbox file format, at: http://www.FreeBSD.org/~keramida/files/freebsd-rdiff.txt - Giorgos == #!/usr/bin/perl # # A filter that copies all the lines from stdin unchanged, until it # matches the magic FreeBSD commit-mail line that says files and # revisions follow. When that line is matched, do our stuff until the # line that matches /^$/; when all file changes are finished. # If this is set to non-zero, then trim EOL whitespace from the # lines of the commit log before copying it to STDOUT. $mail_delete_eol_spaces = 1; # Where would I find the CVSROOT that mirrors the FreeBSD repository? $cvs_root_dir = "/home/ncvs"; # Copy all the lines of STDIN to STDOUT, until we find the part of the # message that contains the file change list. Keep the changelist # lines in an array, and then after the changelist is copied verbatim # to STDOUT too, parse the changelist and call cvs(1) as needed to # view diffs. $in_changelist = 0; # set when we're reading changelist lines @changeset = ();# start with an empty changeset array while (defined($line = )) { chomp $line; if ($mail_delete_eol_spaces) { $line =~ s/\s*$//; } if (($in_changelist eq 0) && ($line =~ m/^ Revision ChangesPath$/)) { print "$line\n"; $in_changelist = 1; } elsif ($in_changelist ne 0) { if ($line =~ m/^$/) { $in_changelist = 0; &show_changeset(\@changeset); } else { unless ($line =~ m/^\s*$/) { $line =~ s/^\s+//; push (@changeset,$line); } } print "$line\n"; } else { print "$line\n"; } } sub show_changeset { my $aref = shift; die "No changeset" unless (defined($aref)); print "\n"; print "--- patch begins ---\n"; foreach $line (@$aref) { ($rev, $added, $deleted, $rcsfile) = &valid_changeline($line); $lastrev = &rev_previous($rev); $pipecmd = "cvs -q -d ${cvs_root_dir} rdiff -u -r$lastrev -r$rev $rcsfile"; open(CVSDIFF, "${pipecmd}|") or die "Could not open input pipe from CVS"; while (defined($in = )) { chomp $in; print "$in\n"; } close(CVSDIFF); } print "--- patch ends ---\n"; } sub valid_changeline { my $line = shift; die "No line passed" unless (defined($line)); ($rev, $added, $deleted, $rcsfile) = split /\s+/, $line; die "Invalid revision \[$rev\]" unless &valid_rcsrev($rev); die "Invalid number of added lines \[$added\]" unless &valid_rcslines($added); die "Invalid number of deleted lines \[$deleted\]" unless &valid_rcslines($deleted); die "No rcsfile specified in changeline \[$line\]" unless (defined($rcsfile)); return ($rev, $added, $deleted, $rcsfile); } sub valid_rcsrev { my $rev = shift; die "No RCS version to validate" unless (defined($rev)); my @foo = split /\./, $rev; return 0 if ($#foo == -1); foreach $k (@foo) { return 0 if ($k = m/\D/); } return 1; } sub valid_rcslines { my $num = shift; die "No RCS lines to validate" unless (defined($num)); return ($num =~ m/^[+-]?\d+$/); } sub rev_previous { my $rev = shift; die "No revision specified" unless (defined($rev)); die "Invalid revision number \[$rev\]" unless &valid_rcsrev($rev); @parts = split /\./, $rev; if (($#parts % 2) eq 0) { # This is a branch revision number. # Just delete the last part to find the branchpoint address. $#parts--; } else { # This is a real revision number. Attempt to either reduce # the last numeric value, or remove the two last parts (when # possible) to find the last revision before a branch point # when the last part is equal to 0. $last = $parts[$#parts]; if ($last gt 1) { $parts[$#parts]--; } elsif ($#parts gt 1) { $#parts -= 2; } } return "" . join('.', @parts) . ""; }