subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Sperling <s...@elego.de>
Subject Re: Show textual diff in a moved/copied file - how?
Date Mon, 26 Feb 2018 08:18:59 GMT
On Sun, Feb 25, 2018 at 11:38:03PM -0800, Alexey Neyman wrote:
> Hi all,
> 
> I am trying to dig for some changes in a file that was moved a few times and
> 'svn diff' shows full "remove old location and add new location as if it
> were a new file" diffs, which are not helpful. Is there a way to make the
> diff show the changes as compared against the origin of the copy? I tried
> --notice-ancestry, does not help.

Diff output changes depending on whether you pass a path to the
file itself or to a parent of the file. Try: svn diff -c 2 barfoo
I found this in the diff_renamed_file() test in diff_tests.py,
see there for more examples.
https://svn.apache.org/repos/asf/subversion/trunk/subversion/tests/cmdline/diff_tests.py

Since you know all paths and revisions involved, you could also run:
  svn diff ^/foobar@1 ^/barfoo@2

> I have a vague recollection that 'svn diff' used to show the changes in such
> copied files before - but I tried the small reproduction script below and it
> shows the same, both with 1.7.22/1.8.17/1.9.7/trunk:
> 
> ---8<---
> #!/bin/bash
> 
> rm -rf /tmp/foo-{svn,wc}
> svnadmin create /tmp/foo-svn
> svn co file:///tmp/foo-svn foo-wc
> cd foo-wc
> echo foo > foobar
> svn add foobar
> svn ci -m "1"
> svn mv foobar barfoo
> echo bar >> barfoo
> svn ci -m "2"
> svn up
> svn diff -c 2
> svn --version
> ---8<---
> 
> 
> Diff output:
> 
> ---8<---
> Index: foobar
> ===================================================================
> --- foobar    (revision 1)
> +++ foobar    (nonexistent)
> @@ -1 +0,0 @@
> -foo
> Index: barfoo
> ===================================================================
> --- barfoo    (nonexistent)
> +++ barfoo    (revision 2)
> @@ -0,0 +1,2 @@
> +foo
> +bar
> ---8<----
> 
> Regards,
> Alexey.
> 

Mime
View raw message