[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Three little diff bugs

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 17 Jul 2014 16:38:17 +0100

I just noticed some 'svn diff' bugs, using svn trunk_at_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_at_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 @@
$ 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_at_3 alpha
A         alpha
$ echo bar >> alpha

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

- Julian
Received on 2014-07-17 17:38:49 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.