##// 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 class monotone_source(converter_source,
111 def mtnrenamefiles(self, files, fromdir, todir):
111 def mtnrenamefiles(self, files, fromdir, todir):
112 renamed = {}
112 renamed = {}
113 for tofile in files:
113 for tofile in files:
114 suffix = tofile.lstrip(todir)
114 if tofile.startswith(todir + '/'):
115 if todir + suffix == tofile:
115 renamed[tofile] = fromdir + tofile[len(todir):]
116 renamed[tofile] = (fromdir + suffix).lstrip("/")
117 return renamed
116 return renamed
118
117
119
120 # implement the converter_source interface:
118 # implement the converter_source interface:
121
119
122 def getheads(self):
120 def getheads(self):
@@ -157,6 +155,7 class monotone_source(converter_source,
157 for tofile, fromfile in renamed.items():
155 for tofile, fromfile in renamed.items():
158 self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") % (fromfile, tofile), '\n')
156 self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") % (fromfile, tofile), '\n')
159 files[tofile] = rev
157 files[tofile] = rev
158 copies[tofile] = fromfile
160 for fromfile in renamed.values():
159 for fromfile in renamed.values():
161 files[fromfile] = rev
160 files[fromfile] = rev
162 return (files.items(), copies)
161 return (files.items(), copies)
@@ -55,7 +55,16 mtn add e
55 mtn drop dir/b
55 mtn drop dir/b
56 mtn mv bin bin2
56 mtn mv bin bin2
57 mtn ci -m 'update2 "with" quotes'
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 mtn mv dir dir2
68 mtn mv dir dir2
60 mtn ci -m movedir
69 mtn ci -m movedir
61 # Test directory removal with empty directory
70 # Test directory removal with empty directory
@@ -85,5 +94,13 hg manifest
85 echo % contents
94 echo % contents
86 cat dir2/a
95 cat dir2/a
87 test -d dir2/dir && echo 'removed dir2/dir is still there!'
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 exit 0
105 exit 0
89
106
@@ -26,32 +26,51 mtn: dropping dir/b from workspace manif
26 mtn: renaming bin to bin2 in workspace manifest
26 mtn: renaming bin to bin2 in workspace manifest
27 mtn: beginning commit on branch 'com.selenic.test'
27 mtn: beginning commit on branch 'com.selenic.test'
28 mtn: committed revision 6c6977a6ef609ec80e40779f89dbd2772c96de62
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 mtn: renaming dir to dir2 in workspace manifest
42 mtn: renaming dir to dir2 in workspace manifest
30 mtn: beginning commit on branch 'com.selenic.test'
43 mtn: beginning commit on branch 'com.selenic.test'
31 mtn: committed revision 5de5abe7c15eae70cf3acdda23c9c319ea50c1af
44 mtn: committed revision a85290b81fc4a8fbce4dc4d956404109842b406e
32 mtn: beginning commit on branch 'com.selenic.test'
45 mtn: beginning commit on branch 'com.selenic.test'
33 mtn: committed revision 27a423be1e406595cc57f50f42a8790fa0a93d8e
46 mtn: committed revision 7e3c8746060117104f16ff2d9212cf0f810cbff0
34 mtn: dropping dir2/dir/subdir/f from workspace manifest
47 mtn: dropping dir2/dir/subdir/f from workspace manifest
35 mtn: dropping dir2/dir/subdir from workspace manifest
48 mtn: dropping dir2/dir/subdir from workspace manifest
36 mtn: dropping dir2/dir/emptydir from workspace manifest
49 mtn: dropping dir2/dir/emptydir from workspace manifest
37 mtn: dropping dir2/dir from workspace manifest
50 mtn: dropping dir2/dir from workspace manifest
38 mtn: beginning commit on branch 'com.selenic.test'
51 mtn: beginning commit on branch 'com.selenic.test'
39 mtn: committed revision ba57ba5ac63178529d37fa8a2a1a012fc0e42047
52 mtn: committed revision a97e0433d041a6d253c5dc27e080d544e55d9c19
40 % convert incrementally
53 % convert incrementally
41 assuming destination repo.mtn-hg
54 assuming destination repo.mtn-hg
42 scanning source...
55 scanning source...
43 sorting...
56 sorting...
44 converting...
57 converting...
45 3 update2 "with" quotes
58 5 update2 "with" quotes
59 4 createdir1
60 3 movedir1
46 2 movedir
61 2 movedir
47 1 emptydir
62 1 emptydir
48 0 dropdirectory
63 0 dropdirectory
49 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 @ 5 "dropdirectory" files: dir2/dir/subdir/f
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 o 2 "update2 "with" quotes" files: bin bin2 dir/b e
75 o 2 "update2 "with" quotes" files: bin bin2 dir/b e
57 |
76 |
@@ -61,8 +80,19 o 0 "initialize" files: a bin c dir/b
61
80
62 % manifest
81 % manifest
63 bin2
82 bin2
83 dir1/subdir2/file1
84 dir1/subdir2_other/file1
64 dir2/a
85 dir2/a
65 e
86 e
66 % contents
87 % contents
67 a
88 a
68 a
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