User: ben
Date: 05/02/07 14:56:01
Modified: xemacs-builds/ben ChangeLog cvs-merge-diff
Log:
Fix usage and further fix deleted files
cvs-merge-diff: 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.
Revision Changes Path
1.2 +9 -0 XEmacs/xemacs-builds/ben/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/ben/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLog 2005/02/07 13:33:21 1.1
+++ ChangeLog 2005/02/07 13:56:00 1.2
@@ -2,6 +2,15 @@
* 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.
+
+2005-02-07 Ben Wing <ben(a)xemacs.org>
+
+ * cvs-merge-diff:
+ * cvs-merge-diff (Value):
* cvs-merge-diff (sort_dot_pound_files):
* cvs-merge-diff (getfile):
Add -debug option and output debug info if so.
1.4 +49 -22 XEmacs/xemacs-builds/ben/cvs-merge-diff
Index: cvs-merge-diff
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/ben/cvs-merge-diff,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cvs-merge-diff 2005/02/07 13:33:22 1.3
+++ cvs-merge-diff 2005/02/07 13:56:01 1.4
@@ -8,7 +8,7 @@
## Author: Ben Wing <ben(a)xemacs.org>
## Maintainer: Ben Wing <ben(a)xemacs.org>
-## Current Version: $Revision: 1.3 $
+## Current Version: $Revision: 1.4 $
## This file is part of XEmacs.
@@ -34,8 +34,8 @@
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 @@
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 @@
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 @@
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