NOTE: This patch has been committed.
ben/ChangeLog addition:
2005-02-07 Ben Wing <ben(a)xemacs.org>
* cvs-merge-diff:
* cvs-merge-diff (Value):
Update usage message.
Always compute revision C because in the process of doing so
we may discover that the local file has been killed, which will
affect the computation of all files/revisions.
xemacs-builds source patch:
Diff command: bash -ci "cvs-diff --show-c-function -no-changelog "
Files affected: ben/cvs-merge-diff
Index: ben/cvs-merge-diff
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/ben/cvs-merge-diff,v
retrieving revision 1.3
diff -u -p -r1.3 cvs-merge-diff
--- ben/cvs-merge-diff 2005/02/07 13:33:22 1.3
+++ ben/cvs-merge-diff 2005/02/07 13:53:52
@@ -34,8 +34,8 @@ my ($myName, $myPath) = fileparse ($0);
require $myPath . "process-diff-args.pl";
-my $usage="
-Usage: $myName -from SPEC -to SPEC FILE
+my $usage=<<EOF;
+Usage: $myName -from SPEC -to SPEC [-debug] [DIFF-OPTIONS...] FILE
Do a diff between various versions of a file, no weird tag syntax necessary.
Quite useful after an update when a manual merge is in progress. Then
@@ -77,8 +77,35 @@ is one of Z, A, B, C, or D or a number,
Note that in the after-merge case, there is no fixed ordering between the
common ancestor (A) and any of the numbered ancestors of (C) -- (A) could
be the same as (1), (3), (8), or any other ancestor.
-";
+Note that, in addition to `-from' and `-to', you can specify any option
+that is valid to `diff' (or to `cvs diff', if both specs are Z, A, C or
+a number, but for the most part the options are the same to both kinds of
+diff). Particularly useful options are `-w', for ignoring all whitespace,
+and `-p', for showing the C function that a change is within.
+
+You can also give the option `-debug' to show debugging information about
+what is executed and which files and revisions are being computed.
+
+Probably the most useful way to run this file is to create shell functions
+as follows:
+
+# `cthis FILE ...': when merging: what change did I make that led to the merge?
+
+function cthis()
+{
+ cvs-merge-diff -from a -to b "$@" | more
+}
+
+# `cthat FILE ...': when merging: what change did the other guy make that
+# led to the merge?
+
+function cthat()
+{
+ cvs-merge-diff -from a -to c "$@" | more
+}
+EOF
+
my @SAVE_ARGV = @ARGV;
my %options;
@@ -138,22 +165,23 @@ die "File $file unknown to CVS" if $cvss
sub Value { return defined $_[0] ? $_[0] : "(undefined)"; }
-if ($spec1 =~ /[bc]/i || $spec2 =~ /[bc]/i) {
- ($killedthis, $filec) = ($cvsstatus =~ /Working revision:\s*(-?)([0-9.]+)$/m);
- die "Can't parse working revision?" if !$filec;
-
- if ($killedthis)
- {
- $filea = $filec;
- print "Revision A (common ancestor): " . Value($filea) . "\n"
if $debug;
- ($filec) = ($cvsstatus =~ /Repository revision:\s*([0-9.]+)\s/);
+# We need to calculate this always because if the file is removed in the
+# local workspace, this will affect all the other files.
+($killedthis, $filec) = ($cvsstatus =~ /Working revision:\s*(-?)([0-9.]+)$/m);
+die "Can't parse working revision?" if !$filec;
+
+if ($killedthis)
+ {
+ $filea = $filec;
+ print "Revision A (common ancestor): " . Value($filea) . "\n" if
$debug;
+ ($filec) = ($cvsstatus =~ /Repository revision:\s*([0-9.]+)\s/);
- die "Can't parse repository revision?" if !$filec;
+ die "Can't parse repository revision?" if !$filec;
- print "Revision C (repository change merged in): " . Value($filec) .
"\n"
- if $debug;
+ print "Revision C (repository change merged in): " . Value($filec) .
"\n"
+ if $debug;
- print <<EOF;
+ print <<EOF;
WARNING: File has been removed in this repository.
Impossible to determine repository change merged into workspace.
@@ -167,12 +195,11 @@ the merged revision), so diffs between t
actual diffs and possibly some extra ones.
EOF
- }
+ }
else
- {
- print "Revision C (repository change merged in): " . Value($filec) .
"\n"
- if $debug;
- }
+ {
+ print "Revision C (repository change merged in): " . Value($filec) .
"\n"
+ if $debug;
}
sub sort_dot_pound_files { -M "$path$a" <=> -M "$path$b"; }
Show replies by date