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

Re: Cannot diff after file rename

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2006-02-09 21:39:31 CET

On Mon, Feb 06, 2006 at 10:48:42PM +0000, Simon Large wrote:
> Having renamed and modified a file in the same commit, I am unable to
> diff the current revision against the previous one using its new name.
> Am I missing something obvious, or is this a bug? Using svn 1.3.0.
>

It's slightly bizarre, but I think the behaviour you're seeing is correct.
(Perhaps not ideal, but correct given our current design).

> svn co file:///c:/temp/diffbug/repos wc
> cd wc
> echo TestA > TestA.txt
> echo TestB > TestB.txt
> svn add TestA.txt TestB.txt
> svn ci -m "r1" .

Okay, so TestA.txt and TestB.txt are now both at r1.

> echo Changed >> TestA.txt
> svn ci -m "r2" .

Now TestA.txt is at r2. Crucially, TestB.txt is still at r1 in the wc.
[*] (I'll refer to this point, later on)

> svn mv TestB.txt TestB-New.txt

You've just moved TestB.txt@r1 to TestB-New.txt.

> echo Renamed >> TestB-New.txt

And modified it, though this shouldn't be important.

> svn ci -m "r3" .

And now you've committed the new versions of TestB.txt (deleted) and
TestB-New.txt (copied from TestB.txt@r1).

> :: These all fail - how do I diff these 2 revs?
> svn diff TestB-New.txt -r3:2
> svn diff TestB-New.txt@BASE -r3:2
> svn diff TestB-New.txt@3 -r3:2
>

That's actually correct. The version of TestB.txt at r2 isn't related
to the version of TestB-New.txt at r3. The graph looks like this:

   r1 r2 r3
TestB.txt --> TestB.txt > TestB-New.txt
    \____________________/

If you just diff -r2:3 (with no target), you'll see that the diff
reports the complete deletion of TestB.txt, and the complete creation
of TestB-New.txt, rather than the diff between them. That's because
they're not related.

(You can force the diff with --old=... --new=..., I think).

'svn log -v' shows the copyfrom information:

r3 | malcolm | 2006-02-09 20:35:49 +0000 (Thu, 09 Feb 2006) | 1 line
Changed paths:
   A /TestB-New.txt (from /TestB.txt:1)
   ...

If, at [*] above, you add 'svn up TestB.txt' or 'svn up' - either of
which will have the effect of bumping the wc revision of TestB.txt to r2,
you'll find that everything works as you'd expect.

Regards,
Malcolm

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 9 21:42:13 2006

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.