[issue1943] convert discards legitimate svn copy information

Patrick Mézard bugs at mercurial.selenic.com
Wed Dec 9 21:22:58 UTC 2009


New submission from Patrick Mézard <pmezard at gmail.com>:

Here is the OP test script:


---------
#!/bin/sh

"$TESTDIR/hghave" svn svn-bindings || exit 80

echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "hgext.graphlog =" >> $HGRCPATH

# Make the svn repository, fill it with 2 files (ok & broken)
svnadmin create svn_repo
svn co file://$(pwd)/svn_repo svn_test
cd svn_test
mkdir docs
date >> docs/ok.txt
date >> docs/broken.txt
svn add docs
svn commit -m 'add docs'

# Move ok *before* deleting the docs directory
svn mv docs/ok.txt .
svn commit -m 'move ok.txt up a level'

# Move broken in the same revision that deletes the docs directory
#svn up
svn mv docs/broken.txt .
svn rm --force docs
svn up
svn commit -m 'flatten docs'
svn resolve --accept=working docs
svn commit -m 'flatten docs'
echo '% svn log'
svn up
svn log -v
cd ..


# Now convert to hg and look at the logs.  The log for ok.txt will span back
# to the first revision.  The log for broken.txt will stop at the "flatten"
revision.
hg convert svn_repo hg_repo
cd hg_repo
echo '% follow ok'
hg log --follow ok.txt
echo '% follow broken'
hg log --follow broken.txt
cd ..
----------------


The copy record broken.txt(docs/broken.txt) is lost.

This is a bug in convert. Here is the svn log of the test svn repo:

+------------------------------------------------------------------------
+r3 | pmezard | 2009-12-09 21:06:57 +0000 (Wed, 09 Dec 2009) | 1 line
+Changed paths:
+   A /broken.txt (from /docs/broken.txt:1)
+   D /docs
+
+flatten docs
+------------------------------------------------------------------------
+r2 | pmezard | 2009-12-09 21:06:54 +0000 (Wed, 09 Dec 2009) | 1 line
+Changed paths:
+   D /docs/ok.txt
+   A /ok.txt (from /docs/ok.txt:1)
+
+move ok.txt up a level
+------------------------------------------------------------------------
+r1 | pmezard | 2009-12-09 21:06:52 +0000 (Wed, 09 Dec 2009) | 1 line
+Changed paths:
+   A /docs
+   A /docs/broken.txt
+   A /docs/ok.txt
+
+add docs
+------------------------------------------------------------------------


Notice the following line in r3:

A /broken.txt (from /docs/broken.txt:1)

Here, broken source is in r1 instead of r2, which throws convert off the
track. Convert cannot know that /docs/broken:1 is actually the same than
/docs/broken:2 and discards the copy information. Please note that svn model
allows both to differ while mercurial one does not. If you add a "svn
update" between r2 and r3, the bug disappears because it picks the parent as
copy source.

hgsubversion actually supports this case because the converter can peek into
converted revisions and check that both records are actually the same.
Unfortunately, this cannot be done with convert architecture which puts a
strong separation between sources and sinks. This kind of issues is one of
the reason why I would like we drop the subversion sink from convert, so we
can give converters the same information than hgsubversion has.

(hgsubversion supports this with its util.issamefile() function).

----------
messages: 11192
nosy: pmezard
priority: bug
status: unread
title: convert discards legitimate svn copy information
topic: convert

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue1943>
____________________________________________________


More information about the Mercurial-devel mailing list