[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: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Tue, 25 Jun 2013 21:47:25 +0200

On Tue, Jun 25, 2013 at 4:24 PM, Tobias Bading <tbading_at_web.de> wrote:
> Dear Devs,
>
> GNU Emacs 24.3 was behaving a little odd today while trying to display a svn
> diff from Annotate mode. It simply barked "svn: Unable to find repository
> location for '...' in revision ..." at me :-(. Since this wasn't the first
> time Emacs left me in the rain like this, I thought it was time to take a
> closer look.
>
> This much I was able to figure out:
>
> If you copy a file from revision N-1, modify the copy and then commit it as
> revision N, 'svn diff -cN FILE' works as expected afterwards. It works no
> matter whether you use Subversion 1.6 or 1.8, no matter whether you specify
> FILE as a working copy path or a repository URL. "Works as expected" meaning
> that it shows the modifications you made, not the entire file as an add.
>
> However, if you copy a file from a revision M that is smaller than N-1,
> modify the copy and then commit it as revision N, 'svn diff -cN FILE' won't
> play along. Subversion 1.6 simply barks "svn: Unable to find repository
> location for 'FILE' in revision N-1", whereas Subversion 1.8 shows the whole
> file as an add, i.e. does a diff -r0:N :-(.

No, it doesn't:

[[[
C:\Temp\svntest>svn --version -q
1.8.0

C:\Temp\svntest>svnadmin create repos

C:\Temp\svntest>svn co file:///c:/temp/svntest/repos wc
Checked out revision 0.

C:\Temp\svntest>cd wc

C:\Temp\svntest\wc>echo "line 1" > file.txt

C:\Temp\svntest\wc>svn add file.txt
A file.txt

C:\Temp\svntest\wc>svn ci -mm
Adding file.txt
Transmitting file data .
Committed revision 1.

C:\Temp\svntest\wc>svn mkdir -mm file:///c:/temp/svntest/repos/dir

Committed revision 2.

C:\Temp\svntest\wc>svn up
Updating '.':
A dir
Updated to revision 2.

C:\Temp\svntest\wc>svn mv file.txt moved.txt
A moved.txt
D file.txt

C:\Temp\svntest\wc>echo "line 2" >> moved.txt

C:\Temp\svntest\wc>svn st
D file.txt
> moved to moved.txt
A + moved.txt
> moved from file.txt

C:\Temp\svntest\wc>svn ci -mm
Deleting file.txt
Adding moved.txt
Transmitting file data .
Committed revision 3.

C:\Temp\svntest\wc>svn up
Updating '.':
At revision 3.

C:\Temp\svntest\wc>svn diff -c3
Index: file.txt
===================================================================
--- file.txt (revision 2)
+++ file.txt (revision 3)
@@ -1 +0,0 @@
-"line 1"
Index: moved.txt
===================================================================
--- moved.txt (revision 0)
+++ moved.txt (revision 3)
@@ -0,0 +1,2 @@
+"line 1"
+"line 2"

C:\Temp\svntest\wc>svn diff -c3 moved.txt
Index: file.txt
===================================================================
--- file.txt (.../file.txt) (revision 2)
+++ file.txt (.../moved.txt) (revision 3)
@@ -1 +1,2 @@
 "line 1"
+"line 2"
]]]

That last diff seems to be the one you want, right?

Or could this be a mixed revision thingy? In your script there was no
'svn update' after committing revision 2, so the copy was made from f1
with working revision 1. In my example it's copied from working
revision 2 (even though it was last changed in r1).

--
Johan
Received on 2013-06-25 21:48:19 CEST

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