Mercurial > hg-stable
changeset 8124:d883bfbd2e60
convert/mtn: handle directory move into moved directory (issue1619/3)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 22 Apr 2009 10:25:05 +0200 |
parents | 933b874e402f |
children | da9f3866c637 |
files | hgext/convert/monotone.py tests/test-convert-mtn tests/test-convert-mtn.out |
diffstat | 3 files changed, 100 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/monotone.py Tue Apr 21 22:31:16 2009 +0200 +++ b/hgext/convert/monotone.py Wed Apr 22 10:25:05 2009 +0200 @@ -160,6 +160,10 @@ continue if tofile.startswith(todir + '/'): renamed[tofile] = fromdir + tofile[len(todir):] + # Avoid chained moves like: + # d1(/a) => d3/d1(/a) + # d2 => d3 + ignoremove[tofile] = 1 for tofile, fromfile in renamed.items(): self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") % (fromfile, tofile), '\n')
--- a/tests/test-convert-mtn Tue Apr 21 22:31:16 2009 +0200 +++ b/tests/test-convert-mtn Wed Apr 22 10:25:05 2009 +0200 @@ -88,6 +88,26 @@ mtn mv dir3/a dir3/d1/a mtn mv dir3/d1 dir3/d2 mtn ci -m dirfilemove2 +echo '% test directory move into another directory move' +mkdir dir4 +mkdir dir5 +echo a > dir4/a +mtn add dir4/a dir5 +mtn ci -m dirdirmove +mtn mv dir5 dir6 +mtn mv dir4 dir6/dir4 +mtn ci -m dirdirmove2 +echo '% test diverging directory moves' +mkdir -p dir7/dir9/dir8 +echo a > dir7/dir9/dir8/a +echo b > dir7/dir9/b +echo c > dir7/c +mtn add -R dir7 +mtn ci -m divergentdirmove +mtn mv dir7 dir7-2 +mtn mv dir7-2/dir9 dir9-2 +mtn mv dir9-2/dir8 dir8-2 +mtn ci -m divergentdirmove2 cd .. echo % convert incrementally @@ -118,5 +138,9 @@ hg manifest -r 5 echo % check file move with directory move hg manifest -r 9 +echo % check file directory directory move +hg manifest -r 11 +echo % check divergent directory moves +hg manifest -r 13 exit 0
--- a/tests/test-convert-mtn.out Tue Apr 21 22:31:16 2009 +0200 +++ b/tests/test-convert-mtn.out Wed Apr 22 10:25:05 2009 +0200 @@ -65,21 +65,58 @@ mtn: renaming dir3/d1 to dir3/d2 in workspace manifest mtn: beginning commit on branch 'com.selenic.test' mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632 +% test directory move into another directory move +mtn: adding dir4 to workspace manifest +mtn: adding dir4/a to workspace manifest +mtn: adding dir5 to workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision 466e0b2afc7a55aa2b4ab2f57cb240bb6cd66fc7 +mtn: renaming dir5 to dir6 in workspace manifest +mtn: skipping dir6, already accounted for in workspace +mtn: renaming dir4 to dir6/dir4 in workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision 3d1f77ebad0c23a5d14911be3b670f990991b749 +% test diverging directory moves +mtn: adding dir7 to workspace manifest +mtn: adding dir7/c to workspace manifest +mtn: adding dir7/dir9 to workspace manifest +mtn: adding dir7/dir9/b to workspace manifest +mtn: adding dir7/dir9/dir8 to workspace manifest +mtn: adding dir7/dir9/dir8/a to workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision 08a08511f18b428d840199b062de90d0396bc2ed +mtn: renaming dir7 to dir7-2 in workspace manifest +mtn: renaming dir7-2/dir9 to dir9-2 in workspace manifest +mtn: renaming dir9-2/dir8 to dir8-2 in workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision 4a736634505795f17786fffdf2c9cbf5b11df6f6 % convert incrementally assuming destination repo.mtn-hg scanning source... sorting... converting... -7 update2 "with" quotes -6 createdir1 -5 movedir1 -4 movedir -3 emptydir -2 dropdirectory -1 dirfilemove -0 dirfilemove2 -7 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ 9 "dirfilemove2" files: dir3/a dir3/d2/a +11 update2 "with" quotes +10 createdir1 +9 movedir1 +8 movedir +7 emptydir +6 dropdirectory +5 dirfilemove +4 dirfilemove2 +3 dirdirmove +2 dirdirmove2 +1 divergentdirmove +0 divergentdirmove2 +11 files updated, 0 files merged, 0 files removed, 0 files unresolved +@ 13 "divergentdirmove2" files: dir7-2/c dir7/c dir7/dir9/b dir7/dir9/dir8/a dir8-2/a dir9-2/b +| +o 12 "divergentdirmove" files: dir7/c dir7/dir9/b dir7/dir9/dir8/a +| +o 11 "dirdirmove2" files: dir4/a dir6/dir4/a +| +o 10 "dirdirmove" files: dir4/a +| +o 9 "dirfilemove2" files: dir3/a dir3/d2/a | o 8 "dirfilemove" files: dir3/a | @@ -106,6 +143,10 @@ dir2/a dir2/newfile dir3/d2/a +dir6/dir4/a +dir7-2/c +dir8-2/a +dir9-2/b e % contents a @@ -135,3 +176,24 @@ dir2/newfile dir3/d2/a e +% check file directory directory move +bin2 +dir1/subdir2/file1 +dir1/subdir2_other/file1 +dir2/a +dir2/newfile +dir3/d2/a +dir6/dir4/a +e +% check divergent directory moves +bin2 +dir1/subdir2/file1 +dir1/subdir2_other/file1 +dir2/a +dir2/newfile +dir3/d2/a +dir6/dir4/a +dir7-2/c +dir8-2/a +dir9-2/b +e