You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Benjamin Fritz <fr...@gmail.com> on 2013/09/10 16:59:27 UTC

Is it possible to see a diff of a "replaced" file?

I'm referring to files with an 'R' status in 'svn log'.

I want to see the changes between the new file, and the file that it replaced.

I can use 'svn cat' to get the old file and then compare it to the new
one, but I am hoping there is a way to have SVN run the diff for me in
one step like it can for comparing two revisions of the same file
(actually I use TortoiseSVN most of the time, but I'd be willing to
drop to the command line for this task if needed).

We have a directory that collects files from various projects in the
repository for building release loadsets for an embedded target, and
I've been using 'svn copy' to replace those files in order to see the
pedigree of the file more easily, but since I did it this way, I
didn't notice when I removed an update somebody made directly to a
file in that location instead of making it in the project folder it
belonged in.

Re: Is it possible to see a diff of a "replaced" file?

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Sep 10, 2013 at 09:59:27AM -0500, Benjamin Fritz wrote:
> I'm referring to files with an 'R' status in 'svn log'.
>
> I want to see the changes between the new file, and the file that it replaced.

'svn diff' does that by default. You have to use the --notice-ancestry
option to force svn not to show a diff between post-replaced and pre-replaced.

So I wonder why you aren't seeing the expected behaviour.
Maybe your Subversion client (Tortoise) sets the notice-ancestry
flag by default?

$ svn cat alpha
alpha
$ svn rm alpha
D         alpha
$ echo foo > alpha
$ svn add alpha
A         alpha
$ svn st alpha                                          
R       alpha
$ svn diff alpha
Index: alpha
===================================================================
--- alpha       (revision 2)
+++ alpha       (working copy)
@@ -1 +1 @@
-alpha
+foo
$ svn diff --notice-ancestry alpha 
Index: alpha
===================================================================
--- alpha       (revision 0)
+++ alpha       (working copy)
@@ -1 +0,0 @@
-alpha
Index: alpha
===================================================================
--- alpha       (revision 0)
+++ alpha       (working copy)
@@ -0,0 +1 @@
+foo
$ svn commit -mm
Replacing      alpha
Transmitting file data .
Committed revision 3.
$ svn log -v -r3
------------------------------------------------------------------------
r3 | stsp | 2013-09-10 17:08:14 +0200 (Tue, 10 Sep 2013) | 1 line
Changed paths:
   R /trunk/alpha

m
------------------------------------------------------------------------
$ svn diff -c3 ^/trunk
Index: alpha
===================================================================
--- alpha       (revision 2)
+++ alpha       (revision 3)
@@ -1 +1 @@
-alpha
+foo
$ svn diff -c3 --notice-ancestry ^/trunk
Index: alpha
===================================================================
--- alpha       (revision 2)
+++ alpha       (revision 3)
@@ -1 +0,0 @@
-alpha
Index: alpha
===================================================================
--- alpha       (revision 0)
+++ alpha       (revision 3)
@@ -0,0 +1 @@
+foo