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

Re: 1.6 vs. 1.8: strange behavior of 'svn diff -cN WC-FILE' if the file was created in rev N by copying

From: Stefan Sperling <stsp_at_elego.de>
Date: Tue, 25 Jun 2013 22:56:15 +0200

On Tue, Jun 25, 2013 at 10:26:08PM +0200, Ben Reser wrote:
> Back to your issue. Since Subversion can't represent the copy as part
> of the diff it tries to do the interoperable thing which is to
> represent the addition of a new file (from a copy) as an addition.

That's not quite true in general. It's more like:

1) If the copyfrom source is part of the operative revision range of
   the diff command, show a modification against the copyfrom source.
   Unless --show-copies-as-adds was passed, because then we always
   show copied files as an addition.

2) If the copyfrom source is not part of the operative revision range,
   history of the file isn't traced back to that revision, so it appears
   as an addition.

It could be argued that 2) is weird special case, and that it should
behave like 1) (i.e. trace back to the copyfrom source anyway) and
only show an addition with --show-copies-as-adds.

Johan pointed out that svnlook diff seems to traverse to the copyfrom
source even in case 2). If this is indeed the case, these commands are
now behaving in contradictory ways :( However, I think it's too late
to change either command now.

> While I understand your interpretation I don't think we are likely to
> change the default output of diff to behave this way. I can see an
> argument for an option to diff to tell it to use the base of copies as
> where they were copied from, but I'm not sure if that's really useful
> when you'd end up not seeing where it was copied from in the diff. So
> IMHO the correct solution to this is to fix the --git option and
> change your vc-svn.el module to pass that flag.

I'm not quite sure if we can already recommend the --git diff option
for widespread use. I intend to get back to it once we can produce
proper information for renames. It's never going to be fully interoperable
with other VCSs in any case because Subversion needs to show all paths
in --git diff headers relative to the repository root to avoid ambiguity
in copyfrom paths. So instead of a/foo/bar.txt like git would show for
any branch, for instance, we get paths like a/trunk/foo/bar.txt or
a/branches/mybranch/foo/bar.txt with svn diff --git, depending on the
branch the diff is made on.
Received on 2013-06-25 22:56:58 CEST

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