3 # Copyright (C) 2001 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
7 # GNU Emacs is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # GNU Emacs is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs; see the file COPYING. If not, write to the
19 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
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>
31 or -<number>, build diffs between revisions OLD and OLD +/- <number>.
32 OLD being `-' means use FILE's current revision.
36 revdiff FILE - -1 get the latest change of FILE
37 revdiff FILE 1.500 +2 get diffs 1.500-1.501 and 1.501-1.502.
49 print "cvs diff -r$old -r$new $file >$file-$old-$new.diff\n";
50 system "cvs diff -r$old -r$new $file >$file-$old-$new.diff";
53 sub current_revision
($)
56 my $dir = dirname
($file);
57 my $base = basename
($file);
58 my $entries = "$dir/CVS/Entries";
59 die "Can't find $entries" unless -f
$entries;
60 open (IN
, "<$entries") or die "Cannot open $entries";
64 if ($line =~ m
,/$base/([^/]+),)
70 die "Cannot determine current revision of $file" unless $rev;
77 $old = current_revision
($file);
82 my $new = shift @ARGV;
83 if ($new =~ /^[+]\d+$/)
86 for ($i = 0; $i < $n; ++$i)
88 unless ($old =~ /(.*)\.(\d+)$/)
98 elsif ($new =~ /^[-]\d+$/)
101 for ($i = 0; $i < $n; ++$i)
103 unless ($old =~ /(.*)\.(\d+)$/)
105 die "Internal error";