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

"svn mv a b; svn mv b a" breaks history?

From: Daniel Shahaf <d.s_at_daniel.shahaf.co.il>
Date: Thu, 8 May 2008 21:06:59 +0300 (Jerusalem Daylight Time)

Summary: The sequence

    svn mv foo bar
    svn mv bar foo
    svn ci foo

breaks the line of history of foo.

To reproduce:

    --------------------------------
    cd wc1
    
    echo Adding file ./foo
    echo foo>foo
    svn -q add foo
    svn -q ci -m "r1: add foo"
    svn -q up
    
    echo Moving back and forth
    svn -q mv foo bar
    svn -q mv bar foo
    
    echo Commit
    svn -q ci -m "r2: mv foo bar; mv bar foo"
    svn -q up
    
    echo Log for ./foo_at_HEAD
    svn log -qv foo
    
    echo Log for ./foo_at_1
    svn log -qv foo_at_1
    
    cd ..
    --------------------------------

Gives output:

    Log for ./foo_at_HEAD
    ------------------------------------------------------------------------
    r2 | daniel | 2008-05-08 20:26:59 +0300 (Thu, 08 May 2008)
    Changed paths:
       R /foo
    ------------------------------------------------------------------------
    Log for ./foo_at_1
    ------------------------------------------------------------------------
    r1 | daniel | 2008-05-08 20:26:55 +0300 (Thu, 08 May 2008)
    Changed paths:
       A /foo
    ------------------------------------------------------------------------

'[1]lucas' on #svn-dev reports that rc5 doesn't report 'foo' as replaced
(with/without history) before committing r2; however, I get the above
output with 1.5.x_at_HEAD as well as with trunk.

The output with an old build (prior to creating the 1.5.x branch) is
better:

    Log for ./foo_at_HEAD
    ------------------------------------------------------------------------
    r2 | daniel | 2008-05-08 20:56:03 +0300 (Thu, 08 May 2008)
    Changed paths:
       R /foo (from /foo:1)
    ------------------------------------------------------------------------
    r1 | daniel | 2008-05-08 20:55:59 +0300 (Thu, 08 May 2008)
    Changed paths:
       A /foo
    ------------------------------------------------------------------------
    Log for ./foo_at_1
    ------------------------------------------------------------------------
    r1 | daniel | 2008-05-08 20:55:59 +0300 (Thu, 08 May 2008)
    Changed paths:
       A /foo
    ------------------------------------------------------------------------

Looking at libsvn_wc/copy.c:determine_copyfrom_info [1], the "svn mv a b;
svn mv b a" scenario is special-cased:

  if (dst_entry && rev == dst_entry->revision &&
      strcmp(url, dst_entry->url) == 0)
    {
      /* Suppress copyfrom info when the copy source is the same as
         for the destination. */
      url = NULL;
      rev = SVN_INVALID_REVNUM;
    }

Why was this check added? It seems to be breaking the line of history
in this scenario.

Daniel

[1] 'blame' assigns the following lines to r25799, which is part of the
fix for issue #756.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-08 20:07:17 CEST

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