Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
There must be a simpler way of doing this. I accidentally committed some files in CVS which I shouldn't have. I needed to revert them to the previous version, but doing this for each file by hand would be tedious, so I wrote the following:
#!/usr/bin/perl
use strict;
use warnings;
my $file = shift or die "usage: $0 filename";
unless ( -f $file ) {
die "($file) does not appear to be a file";
}
my $log = qx{/usr/bin/cvs log $file};
my @versions = $log =~ m{
\n-{28}\n
revision\ (\d+\.\d+)\s*\n
date:\ \d\d\d\d/\d\d/\d\d
}gx;
my ( $current, $previous ) = @versions[ 0, 1 ];
unless ( $current && $previous ) {
die
"Could not determine current ($current) or previous ($previous) versions";
}
`/usr/bin/cvs diff -r$current -r$previous $file | patch --unified`;
What's the easy/correct way to do this?
cvs diff -D (Score:2)
Ilya Martynov (http://martynov.org/ [martynov.org])
Use the tags, Luke (Score:1)
-j("join") option toupdateto revert:cvs update -j after_change -j before_change filename.pl(then commit and tag again, obviously).
You can still do this in your code sample (using the after- and before revision numbers, rather than tags), which would eliminate the pipe to
patch.