# HG changeset patch # User Patrick Mezard # Date 1239484899 -7200 # Node ID 718c8f01feb2813c6864987aa0e1bbe1228ac9a5 # Parent d22432bdcba1dd872fdbffa3491d0f280473a931# Parent 087cc65bebffbd07838c4f303f5799cbd0b0b72b Merge with crew-stable diff -r d22432bdcba1 -r 718c8f01feb2 hgext/convert/monotone.py --- a/hgext/convert/monotone.py Sat Apr 11 21:17:11 2009 +0200 +++ b/hgext/convert/monotone.py Sat Apr 11 23:21:39 2009 +0200 @@ -111,11 +111,10 @@ def mtnrenamefiles(self, files, fromdir, todir): renamed = {} for tofile in files: - if tofile.startswith(todir): + if tofile.startswith(todir + '/'): renamed[tofile] = fromdir + tofile[len(todir):] return renamed - # implement the converter_source interface: def getheads(self): @@ -158,6 +157,7 @@ "from '%s' to '%s'") % (fromfile, tofile), '\n') files[tofile] = rev + copies[tofile] = fromfile for fromfile in renamed.values(): files[fromfile] = rev return (files.items(), copies) diff -r d22432bdcba1 -r 718c8f01feb2 tests/test-convert-mtn --- a/tests/test-convert-mtn Sat Apr 11 21:17:11 2009 +0200 +++ b/tests/test-convert-mtn Sat Apr 11 23:21:39 2009 +0200 @@ -55,7 +55,16 @@ mtn drop dir/b mtn mv bin bin2 mtn ci -m 'update2 "with" quotes' -# Test directory move +echo '% test directory move' +mkdir -p dir1/subdir1 +mkdir -p dir1/subdir2_other +echo file1 > dir1/subdir1/file1 +echo file2 > dir1/subdir2_other/file1 +mtn add dir1/subdir1/file1 dir1/subdir2_other/file1 +mtn ci -m createdir1 +mtn rename dir1/subdir1 dir1/subdir2 +mtn ci -m movedir1 +echo '% test subdirectory move' mtn mv dir dir2 mtn ci -m movedir # Test directory removal with empty directory @@ -85,5 +94,13 @@ echo % contents cat dir2/a test -d dir2/dir && echo 'removed dir2/dir is still there!' + +echo % file move +hg log -v -C -r 1 | grep copies +echo % check directory move +hg manifest -r 4 +test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' +test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' +hg log -v -C -r 4 | grep copies exit 0 diff -r d22432bdcba1 -r 718c8f01feb2 tests/test-convert-mtn.out --- a/tests/test-convert-mtn.out Sat Apr 11 21:17:11 2009 +0200 +++ b/tests/test-convert-mtn.out Sat Apr 11 23:21:39 2009 +0200 @@ -26,32 +26,51 @@ mtn: renaming bin to bin2 in workspace manifest mtn: beginning commit on branch 'com.selenic.test' mtn: committed revision 6c6977a6ef609ec80e40779f89dbd2772c96de62 +% test directory move +mtn: adding dir1 to workspace manifest +mtn: adding dir1/subdir1 to workspace manifest +mtn: adding dir1/subdir1/file1 to workspace manifest +mtn: adding dir1/subdir2_other to workspace manifest +mtn: adding dir1/subdir2_other/file1 to workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision e066b1feb2b7a7110450c2c18b5b4462011427d1 +mtn: skipping dir1, already accounted for in workspace +mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision 2ad2409d25bb8d2583b57a3d4c0fa1df62aa1f79 +% test subdirectory move mtn: renaming dir to dir2 in workspace manifest mtn: beginning commit on branch 'com.selenic.test' -mtn: committed revision 5de5abe7c15eae70cf3acdda23c9c319ea50c1af +mtn: committed revision a85290b81fc4a8fbce4dc4d956404109842b406e mtn: beginning commit on branch 'com.selenic.test' -mtn: committed revision 27a423be1e406595cc57f50f42a8790fa0a93d8e +mtn: committed revision 7e3c8746060117104f16ff2d9212cf0f810cbff0 mtn: dropping dir2/dir/subdir/f from workspace manifest mtn: dropping dir2/dir/subdir from workspace manifest mtn: dropping dir2/dir/emptydir from workspace manifest mtn: dropping dir2/dir from workspace manifest mtn: beginning commit on branch 'com.selenic.test' -mtn: committed revision ba57ba5ac63178529d37fa8a2a1a012fc0e42047 +mtn: committed revision a97e0433d041a6d253c5dc27e080d544e55d9c19 % convert incrementally assuming destination repo.mtn-hg scanning source... sorting... converting... -3 update2 "with" quotes +5 update2 "with" quotes +4 createdir1 +3 movedir1 2 movedir 1 emptydir 0 dropdirectory -3 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ 5 "dropdirectory" files: dir2/dir/subdir/f +5 files updated, 0 files merged, 0 files removed, 0 files unresolved +@ 7 "dropdirectory" files: dir2/dir/subdir/f +| +o 6 "emptydir" files: dir2/dir/subdir/f | -o 4 "emptydir" files: dir2/dir/subdir/f +o 5 "movedir" files: dir/a dir2/a | -o 3 "movedir" files: dir/a dir2/a +o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 +| +o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1 | o 2 "update2 "with" quotes" files: bin bin2 dir/b e | @@ -61,8 +80,19 @@ % manifest bin2 +dir1/subdir2/file1 +dir1/subdir2_other/file1 dir2/a e % contents a a +% file move +copies: dir/a (a) +% check directory move +bin2 +dir/a +dir1/subdir2/file1 +dir1/subdir2_other/file1 +e +copies: dir1/subdir2/file1 (dir1/subdir1/file1) diff -r d22432bdcba1 -r 718c8f01feb2 tests/test-convert-svn-sink --- a/tests/test-convert-svn-sink Sat Apr 11 21:17:11 2009 +0200 +++ b/tests/test-convert-svn-sink Sat Apr 11 23:21:39 2009 +0200 @@ -12,12 +12,12 @@ ( cd $1; svn up; - svn st -v | fixpath + svn st -v | fixpath | sed 's/ */ /g' limit='' if [ $2 -gt 0 ]; then limit="--limit=$2" fi - svn log --xml -v $limit | fixpath | sed 's,.*,,' + svn log --xml -v $limit | fixpath | sed 's,.*,,' | grep -v 'kind="' ) } diff -r d22432bdcba1 -r 718c8f01feb2 tests/test-convert-svn-sink.out --- a/tests/test-convert-svn-sink.out Sat Apr 11 21:17:11 2009 +0200 +++ b/tests/test-convert-svn-sink.out Sat Apr 11 23:21:39 2009 +0200 @@ -12,11 +12,11 @@ 1 add a file 0 modify a file At revision 2. - 2 2 test . - 2 2 test a - 2 1 test d1 - 2 1 test d1/d2 - 2 1 test d1/d2/b + 2 2 test . + 2 2 test a + 2 1 test d1 + 2 1 test d1/d2 + 2 1 test d1/d2/b