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

History of moved files not lost, but svn commands seem to ignore it.

From: Grzegorz Adam Hankiewicz <gradha_at_titanium.sabren.com>
Date: 2004-08-01 18:30:12 CEST

Hello.

I am trying to show the difference between a file in my working copy
and a specific revision number. Between that revision number and the
current copy, the file was moved (renamed). This apparently makes
commands like diff bail out with incorrect results, because they
are unable to get the data from the file before the move operation
took place. Here's a little log of my actions:

 $ echo "First line" > txt
 $ svn add txt
 A txt
 $ svn ci -m ""
 Adding txt
 Transmitting file data .
 Committed revision 5.
 $ echo "Second line" >> txt
 $ svn ci -m ""
 Sending txt
 Transmitting file data .
 Committed revision 6.
 $ svn move txt txt2
 A txt2
 D txt
 $ svn ci -m ""
 Deleting txt
 Adding txt2
 
 Committed revision 7.
 $ echo "Third line" >> txt2
 $ svn ci -m ""
 Sending txt2
 Transmitting file data .
 Committed revision 8.
 $ echo "Empty" > txt2
 $ svn ci -m ""
 Sending txt2
 Transmitting file data .
 Committed revision 9.
 $ svn diff -r6 txt2
 Index: txt2
 ===================================================================
 --- txt2 (revision 0)
 +++ txt2 (revision 9)
 @@ -0,0 +1 @@
 +Empty
 $ svn cat -r6 txt2
 svn: File not found: revision '6', path '/txt2'

If I had two files with the contents of revision 6 and 9 and made
a diff between them, the content would be different from what svn
diff shows. svn cat corroborates that it is impossible to retrieve
a previous version if the file has moved without knowing the location
of the file at the point of the revision.

It is possible to retrieve easily the name of txt2 at the point of
revision 6 by looking at "svn log txt2 -v". The trouble is that the
only way to create the diff is to specify two full repository URLs,
because otherwise svn says that one of them is not in the repository.

 $ svn diff -r 6 --old file:///home/gradha/SVN/test/txt --new file:///home/gradha/SVN/test/txt2
 Index: txt
 ===================================================================
 --- txt (revision 6)
 +++ txt (revision 9)
 @@ -1,2 +1 @@
 -First line
 -Second line
 +Empty

Why is it so difficult to create a diff for a file which has been
moved? Is there an easier way I have missed? Shouldn't the +++
line of the diff tell the new name (txt2)?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Aug 1 18:30:36 2004

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