comparison admin/revdiff @ 39132:570be39418f4

Allow -<number> for OLD.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 05 Sep 2001 08:02:18 +0000
parents f87dbbd87498
children 23a1cea22d13
comparison
equal deleted inserted replaced
39131:544f85c0de57 39132:570be39418f4
25 { 25 {
26 print <<USAGE; 26 print <<USAGE;
27 revdiff FILE OLD NEW 27 revdiff FILE OLD NEW
28 28
29 Get a diff of FILE between revisions OLD and NEW. Store the 29 Get a diff of FILE between revisions OLD and NEW. Store the
30 diff in a file named FILE-OLD-NEW.diff. If NEW is +<number> 30 diff in a file named FILE-OLD-NEW.diff.
31 or -<number>, build diffs between revisions OLD and OLD +/- <number>. 31
32 OLD being `-' means use FILE's current revision. 32 If OLD is `-' use FILE's current revision for OLD. If OLD is
33 `-<number>', use the Nth revision before the current one for OLD.
34
35 If NEW is +<number> or -<number>, build diffs between revisions OLD
36 and OLD +/- <number>.
33 37
34 Examples: 38 Examples:
35 39
36 revdiff FILE - -1 get the latest change of FILE 40 revdiff FILE - -1 get the latest change of FILE
41 revdiff FILE -1 +1 also gets the latest change of FILE
37 revdiff FILE 1.500 +2 get diffs 1.500-1.501 and 1.501-1.502. 42 revdiff FILE 1.500 +2 get diffs 1.500-1.501 and 1.501-1.502.
38 43
39 USAGE 44 USAGE
40 exit 1; 45 exit 1;
41 } 46 }
71 close (IN); 76 close (IN);
72 return $rev; 77 return $rev;
73 } 78 }
74 79
75 if ($old eq "-") 80 if ($old eq "-")
76 { 81 {
77 $old = current_revision ($file); 82 $old = current_revision ($file);
78 } 83 }
84 elsif ($old =~ /^-(\d+)$/)
85 {
86 my $offset = $1;
87 $old = current_revision ($file);
88 die "Internal error" unless $old =~ /(.*)\.(\d+)$/;
89 my $minor = $2 - $offset;
90 $old = sprintf ("%d.%d", $1, $minor);
91 }
79 92
80 while (@ARGV) 93 while (@ARGV)
81 { 94 {
82 my $new = shift @ARGV; 95 my $new = shift @ARGV;
83 if ($new =~ /^[+]\d+$/) 96 if ($new =~ /^[+]\d+$/)