summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-04-01 16:17:12 +0000
committerjoe <joe@FreeBSD.org>2002-04-01 16:17:12 +0000
commitdd3efa66360607e45136634c2e05b1a28b30667c (patch)
tree6438dab11e38dd6af98aaa7bae0bf0d6a62fd206 /tools
parent121ff2ebbefbd54cbf42c50d7a823fb02d82b681 (diff)
downloadFreeBSD-src-dd3efa66360607e45136634c2e05b1a28b30667c.zip
FreeBSD-src-dd3efa66360607e45136634c2e05b1a28b30667c.tar.gz
Take an option flag to specify that we'd like a patch generated too.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/commitsdb/query_commit_db32
1 files changed, 30 insertions, 2 deletions
diff --git a/tools/tools/commitsdb/query_commit_db b/tools/tools/commitsdb/query_commit_db
index f753f32..003d45f 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
OpenPOWER on IntegriCloud