##// END OF EJS Templates
convert/mtn: record changes from directory renames (issue1587)...
Patrick Mezard -
r8050:087cc65b default
parent child Browse files
Show More
@@ -111,12 +111,10 b' class monotone_source(converter_source, '
111 111 def mtnrenamefiles(self, files, fromdir, todir):
112 112 renamed = {}
113 113 for tofile in files:
114 suffix = tofile.lstrip(todir)
115 if todir + suffix == tofile:
116 renamed[tofile] = (fromdir + suffix).lstrip("/")
114 if tofile.startswith(todir + '/'):
115 renamed[tofile] = fromdir + tofile[len(todir):]
117 116 return renamed
118 117
119
120 118 # implement the converter_source interface:
121 119
122 120 def getheads(self):
@@ -157,6 +155,7 b' class monotone_source(converter_source, '
157 155 for tofile, fromfile in renamed.items():
158 156 self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") % (fromfile, tofile), '\n')
159 157 files[tofile] = rev
158 copies[tofile] = fromfile
160 159 for fromfile in renamed.values():
161 160 files[fromfile] = rev
162 161 return (files.items(), copies)
@@ -55,7 +55,16 b' mtn add e'
55 55 mtn drop dir/b
56 56 mtn mv bin bin2
57 57 mtn ci -m 'update2 "with" quotes'
58 # Test directory move
58 echo '% test directory move'
59 mkdir -p dir1/subdir1
60 mkdir -p dir1/subdir2_other
61 echo file1 > dir1/subdir1/file1
62 echo file2 > dir1/subdir2_other/file1
63 mtn add dir1/subdir1/file1 dir1/subdir2_other/file1
64 mtn ci -m createdir1
65 mtn rename dir1/subdir1 dir1/subdir2
66 mtn ci -m movedir1
67 echo '% test subdirectory move'
59 68 mtn mv dir dir2
60 69 mtn ci -m movedir
61 70 # Test directory removal with empty directory
@@ -85,5 +94,13 b' hg manifest'
85 94 echo % contents
86 95 cat dir2/a
87 96 test -d dir2/dir && echo 'removed dir2/dir is still there!'
97
98 echo % file move
99 hg log -v -C -r 1 | grep copies
100 echo % check directory move
101 hg manifest -r 4
102 test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!'
103 test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!'
104 hg log -v -C -r 4 | grep copies
88 105 exit 0
89 106
@@ -26,32 +26,51 b' mtn: dropping dir/b from workspace manif'
26 26 mtn: renaming bin to bin2 in workspace manifest
27 27 mtn: beginning commit on branch 'com.selenic.test'
28 28 mtn: committed revision 6c6977a6ef609ec80e40779f89dbd2772c96de62
29 % test directory move
30 mtn: adding dir1 to workspace manifest
31 mtn: adding dir1/subdir1 to workspace manifest
32 mtn: adding dir1/subdir1/file1 to workspace manifest
33 mtn: adding dir1/subdir2_other to workspace manifest
34 mtn: adding dir1/subdir2_other/file1 to workspace manifest
35 mtn: beginning commit on branch 'com.selenic.test'
36 mtn: committed revision e066b1feb2b7a7110450c2c18b5b4462011427d1
37 mtn: skipping dir1, already accounted for in workspace
38 mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest
39 mtn: beginning commit on branch 'com.selenic.test'
40 mtn: committed revision 2ad2409d25bb8d2583b57a3d4c0fa1df62aa1f79
41 % test subdirectory move
29 42 mtn: renaming dir to dir2 in workspace manifest
30 43 mtn: beginning commit on branch 'com.selenic.test'
31 mtn: committed revision 5de5abe7c15eae70cf3acdda23c9c319ea50c1af
44 mtn: committed revision a85290b81fc4a8fbce4dc4d956404109842b406e
32 45 mtn: beginning commit on branch 'com.selenic.test'
33 mtn: committed revision 27a423be1e406595cc57f50f42a8790fa0a93d8e
46 mtn: committed revision 7e3c8746060117104f16ff2d9212cf0f810cbff0
34 47 mtn: dropping dir2/dir/subdir/f from workspace manifest
35 48 mtn: dropping dir2/dir/subdir from workspace manifest
36 49 mtn: dropping dir2/dir/emptydir from workspace manifest
37 50 mtn: dropping dir2/dir from workspace manifest
38 51 mtn: beginning commit on branch 'com.selenic.test'
39 mtn: committed revision ba57ba5ac63178529d37fa8a2a1a012fc0e42047
52 mtn: committed revision a97e0433d041a6d253c5dc27e080d544e55d9c19
40 53 % convert incrementally
41 54 assuming destination repo.mtn-hg
42 55 scanning source...
43 56 sorting...
44 57 converting...
45 3 update2 "with" quotes
58 5 update2 "with" quotes
59 4 createdir1
60 3 movedir1
46 61 2 movedir
47 62 1 emptydir
48 63 0 dropdirectory
49 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 @ 5 "dropdirectory" files: dir2/dir/subdir/f
64 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 @ 7 "dropdirectory" files: dir2/dir/subdir/f
66 |
67 o 6 "emptydir" files: dir2/dir/subdir/f
51 68 |
52 o 4 "emptydir" files: dir2/dir/subdir/f
69 o 5 "movedir" files: dir/a dir2/a
53 70 |
54 o 3 "movedir" files: dir/a dir2/a
71 o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1
72 |
73 o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1
55 74 |
56 75 o 2 "update2 "with" quotes" files: bin bin2 dir/b e
57 76 |
@@ -61,8 +80,19 b' o 0 "initialize" files: a bin c dir/b'
61 80
62 81 % manifest
63 82 bin2
83 dir1/subdir2/file1
84 dir1/subdir2_other/file1
64 85 dir2/a
65 86 e
66 87 % contents
67 88 a
68 89 a
90 % file move
91 copies: dir/a (a)
92 % check directory move
93 bin2
94 dir/a
95 dir1/subdir2/file1
96 dir1/subdir2_other/file1
97 e
98 copies: dir1/subdir2/file1 (dir1/subdir1/file1)
General Comments 0
You need to be logged in to leave comments. Login now