Show More
@@ -108,13 +108,6 b' class monotone_source(converter_source, ' | |||||
108 | certs[name] = value |
|
108 | certs[name] = value | |
109 | return certs |
|
109 | return certs | |
110 |
|
110 | |||
111 | def mtnrenamefiles(self, files, fromdir, todir): |
|
|||
112 | renamed = {} |
|
|||
113 | for tofile in files: |
|
|||
114 | if tofile.startswith(todir + '/'): |
|
|||
115 | renamed[tofile] = fromdir + tofile[len(todir):] |
|
|||
116 | return renamed |
|
|||
117 |
|
||||
118 | # implement the converter_source interface: |
|
111 | # implement the converter_source interface: | |
119 |
|
112 | |||
120 | def getheads(self): |
|
113 | def getheads(self): | |
@@ -127,15 +120,17 b' class monotone_source(converter_source, ' | |||||
127 | #revision = self.mtncmd("get_revision %s" % rev).split("\n\n") |
|
120 | #revision = self.mtncmd("get_revision %s" % rev).split("\n\n") | |
128 | revision = self.mtnrun("get_revision", rev).split("\n\n") |
|
121 | revision = self.mtnrun("get_revision", rev).split("\n\n") | |
129 | files = {} |
|
122 | files = {} | |
|
123 | addedfiles = {} | |||
|
124 | renameddirs = [] | |||
130 | copies = {} |
|
125 | copies = {} | |
131 | for e in revision: |
|
126 | for e in revision: | |
132 | m = self.add_file_re.match(e) |
|
127 | m = self.add_file_re.match(e) | |
133 | if m: |
|
128 | if m: | |
134 | files[m.group(1)] = rev |
|
129 | files[m.group(1)] = rev | |
|
130 | addedfiles[m.group(1)] = rev | |||
135 | m = self.patch_re.match(e) |
|
131 | m = self.patch_re.match(e) | |
136 | if m: |
|
132 | if m: | |
137 | files[m.group(1)] = rev |
|
133 | files[m.group(1)] = rev | |
138 |
|
||||
139 | # Delete/rename is handled later when the convert engine |
|
134 | # Delete/rename is handled later when the convert engine | |
140 | # discovers an IOError exception from getfile, |
|
135 | # discovers an IOError exception from getfile, | |
141 | # but only if we add the "from" file to the list of changes. |
|
136 | # but only if we add the "from" file to the list of changes. | |
@@ -150,14 +145,26 b' class monotone_source(converter_source, ' | |||||
150 | copies[toname] = fromname |
|
145 | copies[toname] = fromname | |
151 | files[toname] = rev |
|
146 | files[toname] = rev | |
152 | files[fromname] = rev |
|
147 | files[fromname] = rev | |
153 | if self.mtnisdir(toname, rev): |
|
148 | elif self.mtnisdir(toname, rev): | |
154 |
renamed |
|
149 | renameddirs.append((fromname, toname)) | |
|
150 | ||||
|
151 | # Directory renames can be handled only once we have recorded | |||
|
152 | # all new files | |||
|
153 | for fromdir, todir in renameddirs: | |||
|
154 | renamed = {} | |||
|
155 | for tofile in self.files: | |||
|
156 | if tofile in addedfiles: | |||
|
157 | continue | |||
|
158 | if tofile.startswith(todir + '/'): | |||
|
159 | renamed[tofile] = fromdir + tofile[len(todir):] | |||
155 |
|
|
160 | for tofile, fromfile in renamed.items(): | |
156 |
|
|
161 | self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") | |
|
162 | % (fromfile, tofile), '\n') | |||
157 |
|
|
163 | files[tofile] = rev | |
158 |
|
|
164 | copies[tofile] = fromfile | |
159 |
|
|
165 | for fromfile in renamed.values(): | |
160 |
|
|
166 | files[fromfile] = rev | |
|
167 | ||||
161 | return (files.items(), copies) |
|
168 | return (files.items(), copies) | |
162 |
|
169 | |||
163 | def getmode(self, name, rev): |
|
170 | def getmode(self, name, rev): |
@@ -33,9 +33,10 b' cd workingdir' | |||||
33 | echo a > a |
|
33 | echo a > a | |
34 | mkdir dir |
|
34 | mkdir dir | |
35 | echo b > dir/b |
|
35 | echo b > dir/b | |
|
36 | echo d > dir/d | |||
36 | python -c 'file("bin", "wb").write("a\\x00b")' |
|
37 | python -c 'file("bin", "wb").write("a\\x00b")' | |
37 | echo c > c |
|
38 | echo c > c | |
38 | mtn add a dir/b c bin |
|
39 | mtn add a dir/b dir/d c bin | |
39 | mtn ci -m initialize |
|
40 | mtn ci -m initialize | |
40 | echo % update monotone working directory |
|
41 | echo % update monotone working directory | |
41 | mtn mv a dir/a |
|
42 | mtn mv a dir/a | |
@@ -66,6 +67,9 b' mtn rename dir1/subdir1 dir1/subdir2' | |||||
66 | mtn ci -m movedir1 |
|
67 | mtn ci -m movedir1 | |
67 | echo '% test subdirectory move' |
|
68 | echo '% test subdirectory move' | |
68 | mtn mv dir dir2 |
|
69 | mtn mv dir dir2 | |
|
70 | echo newfile > dir2/newfile | |||
|
71 | mtn drop dir2/d | |||
|
72 | mtn add dir2/newfile | |||
69 | mtn ci -m movedir |
|
73 | mtn ci -m movedir | |
70 | # Test directory removal with empty directory |
|
74 | # Test directory removal with empty directory | |
71 | mkdir dir2/dir |
|
75 | mkdir dir2/dir | |
@@ -102,5 +106,7 b' hg manifest -r 4' | |||||
102 | test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' |
|
106 | test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' | |
103 | test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' |
|
107 | test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' | |
104 | hg log -v -C -r 4 | grep copies |
|
108 | hg log -v -C -r 4 | grep copies | |
|
109 | echo % check file remove with directory move | |||
|
110 | hg manifest -r 5 | |||
105 | exit 0 |
|
111 | exit 0 | |
106 |
|
112 |
@@ -5,14 +5,15 b' mtn: adding bin to workspace manifest' | |||||
5 | mtn: adding c to workspace manifest |
|
5 | mtn: adding c to workspace manifest | |
6 | mtn: adding dir to workspace manifest |
|
6 | mtn: adding dir to workspace manifest | |
7 | mtn: adding dir/b to workspace manifest |
|
7 | mtn: adding dir/b to workspace manifest | |
|
8 | mtn: adding dir/d to workspace manifest | |||
8 | mtn: beginning commit on branch 'com.selenic.test' |
|
9 | mtn: beginning commit on branch 'com.selenic.test' | |
9 | mtn: committed revision 803ef0bf815e35b951dbd4310acd1e45e675016e |
|
10 | mtn: committed revision 0f6e5e4f2e7d2a8ef312408f57618abf026afd90 | |
10 | % update monotone working directory |
|
11 | % update monotone working directory | |
11 | mtn: skipping dir, already accounted for in workspace |
|
12 | mtn: skipping dir, already accounted for in workspace | |
12 | mtn: renaming a to dir/a in workspace manifest |
|
13 | mtn: renaming a to dir/a in workspace manifest | |
13 | mtn: dropping c from workspace manifest |
|
14 | mtn: dropping c from workspace manifest | |
14 | mtn: beginning commit on branch 'com.selenic.test' |
|
15 | mtn: beginning commit on branch 'com.selenic.test' | |
15 | mtn: committed revision 4daf60753d6fe21a06ce5f716303fe55fd6d3a56 |
|
16 | mtn: committed revision 51d0a982464573a2a2cf5ee2c9219c652aaebeff | |
16 | % convert once |
|
17 | % convert once | |
17 | assuming destination repo.mtn-hg |
|
18 | assuming destination repo.mtn-hg | |
18 | initializing destination repo.mtn-hg repository |
|
19 | initializing destination repo.mtn-hg repository | |
@@ -25,7 +26,7 b' mtn: adding e to workspace manifest' | |||||
25 | mtn: dropping dir/b from workspace manifest |
|
26 | mtn: dropping dir/b from workspace manifest | |
26 | mtn: renaming bin to bin2 in workspace manifest |
|
27 | mtn: renaming bin to bin2 in workspace manifest | |
27 | mtn: beginning commit on branch 'com.selenic.test' |
|
28 | mtn: beginning commit on branch 'com.selenic.test' | |
28 | mtn: committed revision 6c6977a6ef609ec80e40779f89dbd2772c96de62 |
|
29 | mtn: committed revision ebe58335d85d8cb176b6d0a12be04f5314b998da | |
29 | % test directory move |
|
30 | % test directory move | |
30 | mtn: adding dir1 to workspace manifest |
|
31 | mtn: adding dir1 to workspace manifest | |
31 | mtn: adding dir1/subdir1 to workspace manifest |
|
32 | mtn: adding dir1/subdir1 to workspace manifest | |
@@ -33,23 +34,25 b' mtn: adding dir1/subdir1/file1 to worksp' | |||||
33 | mtn: adding dir1/subdir2_other to workspace manifest |
|
34 | mtn: adding dir1/subdir2_other to workspace manifest | |
34 | mtn: adding dir1/subdir2_other/file1 to workspace manifest |
|
35 | mtn: adding dir1/subdir2_other/file1 to workspace manifest | |
35 | mtn: beginning commit on branch 'com.selenic.test' |
|
36 | mtn: beginning commit on branch 'com.selenic.test' | |
36 | mtn: committed revision e066b1feb2b7a7110450c2c18b5b4462011427d1 |
|
37 | mtn: committed revision a8d62bc04fee4d2936d28e98bbcc81686dd74306 | |
37 | mtn: skipping dir1, already accounted for in workspace |
|
38 | mtn: skipping dir1, already accounted for in workspace | |
38 | mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest |
|
39 | mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest | |
39 | mtn: beginning commit on branch 'com.selenic.test' |
|
40 | mtn: beginning commit on branch 'com.selenic.test' | |
40 | mtn: committed revision 2ad2409d25bb8d2583b57a3d4c0fa1df62aa1f79 |
|
41 | mtn: committed revision 2c3d241bbbfe538b1b51d910f5676407e3f4d3a6 | |
41 | % test subdirectory move |
|
42 | % test subdirectory move | |
42 | mtn: renaming dir to dir2 in workspace manifest |
|
43 | mtn: renaming dir to dir2 in workspace manifest | |
|
44 | mtn: dropping dir2/d from workspace manifest | |||
|
45 | mtn: adding dir2/newfile to workspace manifest | |||
43 | mtn: beginning commit on branch 'com.selenic.test' |
|
46 | mtn: beginning commit on branch 'com.selenic.test' | |
44 | mtn: committed revision a85290b81fc4a8fbce4dc4d956404109842b406e |
|
47 | mtn: committed revision fdb5a02dae8bfce3a79b3393680af471016e1b4c | |
45 | mtn: beginning commit on branch 'com.selenic.test' |
|
48 | mtn: beginning commit on branch 'com.selenic.test' | |
46 | mtn: committed revision 7e3c8746060117104f16ff2d9212cf0f810cbff0 |
|
49 | mtn: committed revision 8bbf76d717001d24964e4604739fdcd0f539fc88 | |
47 | mtn: dropping dir2/dir/subdir/f from workspace manifest |
|
50 | mtn: dropping dir2/dir/subdir/f from workspace manifest | |
48 | mtn: dropping dir2/dir/subdir from workspace manifest |
|
51 | mtn: dropping dir2/dir/subdir from workspace manifest | |
49 | mtn: dropping dir2/dir/emptydir from workspace manifest |
|
52 | mtn: dropping dir2/dir/emptydir from workspace manifest | |
50 | mtn: dropping dir2/dir from workspace manifest |
|
53 | mtn: dropping dir2/dir from workspace manifest | |
51 | mtn: beginning commit on branch 'com.selenic.test' |
|
54 | mtn: beginning commit on branch 'com.selenic.test' | |
52 | mtn: committed revision a97e0433d041a6d253c5dc27e080d544e55d9c19 |
|
55 | mtn: committed revision 2323d4bc324e6c82628dc04d47a9fd32ad24e322 | |
53 | % convert incrementally |
|
56 | % convert incrementally | |
54 | assuming destination repo.mtn-hg |
|
57 | assuming destination repo.mtn-hg | |
55 | scanning source... |
|
58 | scanning source... | |
@@ -61,12 +64,12 b' 3 movedir1' | |||||
61 | 2 movedir |
|
64 | 2 movedir | |
62 | 1 emptydir |
|
65 | 1 emptydir | |
63 | 0 dropdirectory |
|
66 | 0 dropdirectory | |
64 |
|
|
67 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
65 | @ 7 "dropdirectory" files: dir2/dir/subdir/f |
|
68 | @ 7 "dropdirectory" files: dir2/dir/subdir/f | |
66 | | |
|
69 | | | |
67 | o 6 "emptydir" files: dir2/dir/subdir/f |
|
70 | o 6 "emptydir" files: dir2/dir/subdir/f | |
68 | | |
|
71 | | | |
69 | o 5 "movedir" files: dir/a dir2/a |
|
72 | o 5 "movedir" files: dir/a dir/d dir2/a dir2/newfile | |
70 | | |
|
73 | | | |
71 | o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 |
|
74 | o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 | |
72 | | |
|
75 | | | |
@@ -76,13 +79,14 b' o 2 "update2 "with" quotes" files: bin ' | |||||
76 | | |
|
79 | | | |
77 | o 1 "update1" files: a bin c dir/a dir/b |
|
80 | o 1 "update1" files: a bin c dir/a dir/b | |
78 | | |
|
81 | | | |
79 | o 0 "initialize" files: a bin c dir/b |
|
82 | o 0 "initialize" files: a bin c dir/b dir/d | |
80 |
|
83 | |||
81 | % manifest |
|
84 | % manifest | |
82 | bin2 |
|
85 | bin2 | |
83 | dir1/subdir2/file1 |
|
86 | dir1/subdir2/file1 | |
84 | dir1/subdir2_other/file1 |
|
87 | dir1/subdir2_other/file1 | |
85 | dir2/a |
|
88 | dir2/a | |
|
89 | dir2/newfile | |||
86 | e |
|
90 | e | |
87 | % contents |
|
91 | % contents | |
88 | a |
|
92 | a | |
@@ -92,7 +96,15 b' copies: dir/a (a)' | |||||
92 | % check directory move |
|
96 | % check directory move | |
93 | bin2 |
|
97 | bin2 | |
94 | dir/a |
|
98 | dir/a | |
|
99 | dir/d | |||
95 | dir1/subdir2/file1 |
|
100 | dir1/subdir2/file1 | |
96 | dir1/subdir2_other/file1 |
|
101 | dir1/subdir2_other/file1 | |
97 | e |
|
102 | e | |
98 | copies: dir1/subdir2/file1 (dir1/subdir1/file1) |
|
103 | copies: dir1/subdir2/file1 (dir1/subdir1/file1) | |
|
104 | % check file remove with directory move | |||
|
105 | bin2 | |||
|
106 | dir1/subdir2/file1 | |||
|
107 | dir1/subdir2_other/file1 | |||
|
108 | dir2/a | |||
|
109 | dir2/newfile | |||
|
110 | e |
General Comments 0
You need to be logged in to leave comments.
Login now