Merge with crew-stable
authorPatrick Mezard <pmezard@gmail.com>
Sat, 11 Apr 2009 23:21:39 +0200
changeset 8051 718c8f01feb2
parent 8048 d22432bdcba1 (current diff)
parent 8050 087cc65bebff (diff)
child 8052 fe2a87a3d344
Merge with crew-stable
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)
--- 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
 
--- 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)
--- 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,<date>.*,<date/>,'
+       svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' | grep -v 'kind="'
     )
 }
 
--- 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
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -63,11 +63,11 @@
 converting...
 0 rename a file
 At revision 3.
-                3        3 test         .
-                3        3 test         b
-                3        1 test         d1
-                3        1 test         d1/d2
-                3        1 test         d1/d2/b
+ 3 3 test .
+ 3 3 test b
+ 3 1 test d1
+ 3 1 test d1/d2
+ 3 1 test d1/d2/b
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -101,12 +101,12 @@
 converting...
 0 copy a file
 At revision 4.
-                4        4 test         .
-                4        3 test         b
-                4        4 test         c
-                4        1 test         d1
-                4        1 test         d1/d2
-                4        1 test         d1/d2/b
+ 4 4 test .
+ 4 3 test b
+ 4 4 test c
+ 4 1 test d1
+ 4 1 test d1/d2
+ 4 1 test d1/d2/b
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -140,11 +140,11 @@
 converting...
 0 remove a file
 At revision 5.
-                5        5 test         .
-                5        4 test         c
-                5        1 test         d1
-                5        1 test         d1/d2
-                5        1 test         d1/d2/b
+ 5 5 test .
+ 5 4 test c
+ 5 1 test d1
+ 5 1 test d1/d2
+ 5 1 test d1/d2/b
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -174,11 +174,11 @@
 converting...
 0 make a file executable
 At revision 6.
-                6        6 test         .
-                6        6 test         c
-                6        1 test         d1
-                6        1 test         d1/d2
-                6        1 test         d1/d2/b
+ 6 6 test .
+ 6 6 test c
+ 6 1 test d1
+ 6 1 test d1/d2
+ 6 1 test d1/d2/b
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -203,9 +203,9 @@
 converting...
 0 add executable file in new directory
 At revision 1.
-                1        1 test         .
-                1        1 test         d1
-                1        1 test         d1/a
+ 1 1 test .
+ 1 1 test d1
+ 1 1 test d1/a
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -230,11 +230,11 @@
 converting...
 0 copy file to new directory
 At revision 2.
-                2        2 test         .
-                2        1 test         d1
-                2        1 test         d1/a
-                2        2 test         d2
-                2        2 test         d2/a
+ 2 2 test .
+ 2 1 test d1
+ 2 1 test d1/a
+ 2 2 test d2
+ 2 2 test d2/a
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -280,12 +280,12 @@
 0 merge
 % expect 4 changes
 At revision 4.
-                4        4 test         .
-                4        3 test         b
-                4        2 test         left-1
-                4        3 test         left-2
-                4        4 test         right-1
-                4        4 test         right-2
+ 4 4 test .
+ 4 3 test b
+ 4 2 test left-1
+ 4 3 test left-2
+ 4 4 test right-1
+ 4 4 test right-2
 <?xml version="1.0"?>
 <log>
 <logentry