I just noticed some 'svn diff' bugs, using svn trunk@1611327 (with a few local 
mods related to mergeinfo parsing, that should not affect diffs).


Bug 1.

We print a diff header in front of an empty diff, for a copied-but-not-modified 
file, where we didn't previously.

[[[
$ svn cp ^/trunk/alpha@1 alpha2
A         alpha2
$ svn diff
Index: alpha2
===================================================================
$ svn18 diff   # svn18 is Subversion 1.8.9
]]]


Bug 2.

We show the left-hand-side revision as 'nonexistent' for a copied-and-modified 
file diff, where the real left-hand side of the diff is the copy-from revision 
(revision 1 in this example).

[[[
$ echo foo >> alpha2 
$ svn diff  # diffing against the copy source
Index: alpha2
===================================================================
--- alpha2    (nonexistent)
+++ alpha2    (working copy)
@@ -1 +1,2 @@
 alpha
+foo
$ svn info alpha2
[...]
Relative URL: ^/trunk/alpha2
Revision: 1
Schedule: add
Copied From URL: file:///.../trunk/alpha
Copied From Rev: 1
Last Changed Rev: 1
]]]


Bug 3.

A WC-WC diff shows a replace-with-copy-from-self as a delete and an add, when 
the 'notice-ancestry' option is given. (If we commit the change, then a 
repos-repos diff of the change with '--notice-ancestry' shows a single diff, as 
it should.)

I suppose the WC-WC diff always assumes that any copied replacement node is 
unrelated to the replaced node.

In the (very) special case where the copy source path and revision are exactly 
equal to the replaced node's base path and revision, this would be easy to 
detect as related, but other cases would, in general, require contacting the 
repository.

[[[
$ svn rm alpha 
D         alpha
$ svn cp ^/trunk/new/alpha@3 alpha
A         alpha
$ echo bar >> alpha 

$ svn diff --notice-ancestry 
Index: alpha
===================================================================
--- alpha    (revision 6)
+++ alpha    (nonexistent)
@@ -1,2 +0,0 @@
-alpha
-hello
Index: alpha
===================================================================
--- alpha    (nonexistent)
+++ alpha    (working copy)
@@ -1 +1,2 @@
 alpha
+bar
]]]


- Julian

Reply via email to