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

Re: Show textual diff in a moved/copied file - how?

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 26 Feb 2018 09:18:59 +0100

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_at_1 ^/barfoo_at_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.
>
Received on 2018-02-26 09:19:20 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.