diff options
author | Josef Karthauser <joe@FreeBSD.org> | 2002-04-01 16:17:12 +0000 |
---|---|---|
committer | Josef Karthauser <joe@FreeBSD.org> | 2002-04-01 16:17:12 +0000 |
commit | 0b6b585a31f76dca698e2a5d7ebd16abaa9a64b1 (patch) | |
tree | 6438dab11e38dd6af98aaa7bae0bf0d6a62fd206 /tools | |
parent | 3d246faa5aa7af7c811cb60ba0e86f55da02e00c (diff) | |
download | src-0b6b585a31f76dca698e2a5d7ebd16abaa9a64b1.tar.gz src-0b6b585a31f76dca698e2a5d7ebd16abaa9a64b1.zip |
Take an option flag to specify that we'd like a patch generated too.
Notes
Notes:
svn path=/head/; revision=93545
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/commitsdb/query_commit_db | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tools/tools/commitsdb/query_commit_db b/tools/tools/commitsdb/query_commit_db index f753f327b898..003d45fef47a 100644 --- a/tools/tools/commitsdb/query_commit_db +++ b/tools/tools/commitsdb/query_commit_db @@ -13,7 +13,8 @@ use Digest::MD5 qw(md5_hex); my $dbname = "commitsdb"; # Take the filename and revision number from the command line. -my ($file, $revision) = (shift, shift); +# Also take a flag to say whether to generate a patch or not. +my ($file, $revision, $genpatch) = (shift, shift, shift); # Find the checksum of the named revision. my %possible_files; @@ -56,6 +57,33 @@ while (<DB>) { } close DB; -print map { "$_\n" } sort @results; +foreach my $r (sort @results) { + print "$r\n"; + next unless $genpatch; + + my ($name, $rev) = split /\s/, $r, 2; + my $prevrev = previous_revision($rev); + print `cvs diff -u -r$prevrev -r$rev $name`; + print "\n\n"; +} + +# +# Return the previous revision number. +# +sub previous_revision { + my $rev = shift; + + $rev =~ /(?:(.*)\.)?([^\.]+)\.([^\.]+)$/; + my ($base, $r1, $r2) = ($1, $2, $3); + + my $prevrev = ""; + if ($r2 == 1) { + $prevrev = $base; + } else { + $prevrev = "$base." if $base; + $prevrev .= "$r1." . ($r2 - 1); + } + return $prevrev; +} #end |