Show More
@@ -0,0 +1,30 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | "$TESTDIR/hghave" bzr114 || exit 80 | |||
|
4 | ||||
|
5 | . "$TESTDIR/bzr-definitions" | |||
|
6 | ||||
|
7 | # The file/directory replacement can only be reproduced on | |||
|
8 | # bzr >= 1.4. Merge it back in test-convert-bzr-directories once | |||
|
9 | # this version becomes mainstream. | |||
|
10 | echo % replace file with dir | |||
|
11 | mkdir test-replace-file-with-dir | |||
|
12 | cd test-replace-file-with-dir | |||
|
13 | bzr init -q source | |||
|
14 | cd source | |||
|
15 | echo d > d | |||
|
16 | bzr add -q d | |||
|
17 | bzr commit -q -m 'add d file' | |||
|
18 | rm d | |||
|
19 | mkdir d | |||
|
20 | bzr add -q d | |||
|
21 | bzr commit -q -m 'replace with d dir' | |||
|
22 | echo a > d/a | |||
|
23 | bzr add -q d/a | |||
|
24 | bzr commit -q -m 'add d/a' | |||
|
25 | cd .. | |||
|
26 | hg convert source source-hg | |||
|
27 | manifest source-hg tip | |||
|
28 | cd source-hg | |||
|
29 | hg update | |||
|
30 | cd ../.. |
@@ -0,0 +1,11 b'' | |||||
|
1 | % replace file with dir | |||
|
2 | initializing destination source-hg repository | |||
|
3 | scanning source... | |||
|
4 | sorting... | |||
|
5 | converting... | |||
|
6 | 2 add d file | |||
|
7 | 1 replace with d dir | |||
|
8 | 0 add d/a | |||
|
9 | % manifest of tip | |||
|
10 | 644 d/a | |||
|
11 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
@@ -148,6 +148,11 b' class bzr_source(converter_source):' | |||||
148 | # bazaar tracks directories, mercurial does not, so |
|
148 | # bazaar tracks directories, mercurial does not, so | |
149 | # we have to rename the directory contents |
|
149 | # we have to rename the directory contents | |
150 | if kind[1] == 'directory': |
|
150 | if kind[1] == 'directory': | |
|
151 | if kind[0] not in (None, 'directory'): | |||
|
152 | # Replacing 'something' with a directory, record it | |||
|
153 | # so it can be removed. | |||
|
154 | changes.append((self.recode(paths[0]), revid)) | |||
|
155 | ||||
151 | if None not in paths and paths[0] != paths[1]: |
|
156 | if None not in paths and paths[0] != paths[1]: | |
152 | # neither an add nor an delete - a move |
|
157 | # neither an add nor an delete - a move | |
153 | # rename all directory contents manually |
|
158 | # rename all directory contents manually |
@@ -113,7 +113,8 b' class monotone_source(converter_source, ' | |||||
113 | value = value.replace(r'\\', '\\') |
|
113 | value = value.replace(r'\\', '\\') | |
114 | certs[name] = value |
|
114 | certs[name] = value | |
115 | # Monotone may have subsecond dates: 2005-02-05T09:39:12.364306 |
|
115 | # Monotone may have subsecond dates: 2005-02-05T09:39:12.364306 | |
116 | certs["date"] = certs["date"].split('.')[0] |
|
116 | # and all times are stored in UTC | |
|
117 | certs["date"] = certs["date"].split('.')[0] + " UTC" | |||
117 | return certs |
|
118 | return certs | |
118 |
|
119 | |||
119 | # implement the converter_source interface: |
|
120 | # implement the converter_source interface: | |
@@ -128,14 +129,14 b' class monotone_source(converter_source, ' | |||||
128 | #revision = self.mtncmd("get_revision %s" % rev).split("\n\n") |
|
129 | #revision = self.mtncmd("get_revision %s" % rev).split("\n\n") | |
129 | revision = self.mtnrun("get_revision", rev).split("\n\n") |
|
130 | revision = self.mtnrun("get_revision", rev).split("\n\n") | |
130 | files = {} |
|
131 | files = {} | |
131 |
|
|
132 | ignoremove = {} | |
132 | renameddirs = [] |
|
133 | renameddirs = [] | |
133 | copies = {} |
|
134 | copies = {} | |
134 | for e in revision: |
|
135 | for e in revision: | |
135 | m = self.add_file_re.match(e) |
|
136 | m = self.add_file_re.match(e) | |
136 | if m: |
|
137 | if m: | |
137 | files[m.group(1)] = rev |
|
138 | files[m.group(1)] = rev | |
138 |
|
|
139 | ignoremove[m.group(1)] = rev | |
139 | m = self.patch_re.match(e) |
|
140 | m = self.patch_re.match(e) | |
140 | if m: |
|
141 | if m: | |
141 | files[m.group(1)] = rev |
|
142 | files[m.group(1)] = rev | |
@@ -150,6 +151,7 b' class monotone_source(converter_source, ' | |||||
150 | toname = m.group(2) |
|
151 | toname = m.group(2) | |
151 | fromname = m.group(1) |
|
152 | fromname = m.group(1) | |
152 | if self.mtnisfile(toname, rev): |
|
153 | if self.mtnisfile(toname, rev): | |
|
154 | ignoremove[toname] = 1 | |||
153 | copies[toname] = fromname |
|
155 | copies[toname] = fromname | |
154 | files[toname] = rev |
|
156 | files[toname] = rev | |
155 | files[fromname] = rev |
|
157 | files[fromname] = rev | |
@@ -161,10 +163,14 b' class monotone_source(converter_source, ' | |||||
161 | for fromdir, todir in renameddirs: |
|
163 | for fromdir, todir in renameddirs: | |
162 | renamed = {} |
|
164 | renamed = {} | |
163 | for tofile in self.files: |
|
165 | for tofile in self.files: | |
164 |
if tofile in |
|
166 | if tofile in ignoremove: | |
165 | continue |
|
167 | continue | |
166 | if tofile.startswith(todir + '/'): |
|
168 | if tofile.startswith(todir + '/'): | |
167 | renamed[tofile] = fromdir + tofile[len(todir):] |
|
169 | renamed[tofile] = fromdir + tofile[len(todir):] | |
|
170 | # Avoid chained moves like: | |||
|
171 | # d1(/a) => d3/d1(/a) | |||
|
172 | # d2 => d3 | |||
|
173 | ignoremove[tofile] = 1 | |||
168 | for tofile, fromfile in renamed.items(): |
|
174 | for tofile, fromfile in renamed.items(): | |
169 | self.ui.debug (_("copying file in renamed directory " |
|
175 | self.ui.debug (_("copying file in renamed directory " | |
170 | "from '%s' to '%s'") |
|
176 | "from '%s' to '%s'") |
@@ -31,6 +31,14 b' def has_bzr():' | |||||
31 | except ImportError: |
|
31 | except ImportError: | |
32 | return False |
|
32 | return False | |
33 |
|
33 | |||
|
34 | def has_bzr114(): | |||
|
35 | try: | |||
|
36 | import bzrlib | |||
|
37 | return (bzrlib.__doc__ != None | |||
|
38 | and bzrlib.version_info[:2] == (1, 14)) | |||
|
39 | except ImportError: | |||
|
40 | return False | |||
|
41 | ||||
34 | def has_cvs(): |
|
42 | def has_cvs(): | |
35 | re = r'Concurrent Versions System.*?server' |
|
43 | re = r'Concurrent Versions System.*?server' | |
36 | return matchoutput('cvs --version 2>&1', re) |
|
44 | return matchoutput('cvs --version 2>&1', re) | |
@@ -163,6 +171,7 b' def has_outer_repo():' | |||||
163 | checks = { |
|
171 | checks = { | |
164 | "baz": (has_baz, "GNU Arch baz client"), |
|
172 | "baz": (has_baz, "GNU Arch baz client"), | |
165 | "bzr": (has_bzr, "Canonical's Bazaar client"), |
|
173 | "bzr": (has_bzr, "Canonical's Bazaar client"), | |
|
174 | "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"), | |||
166 | "cvs": (has_cvs, "cvs client/server"), |
|
175 | "cvs": (has_cvs, "cvs client/server"), | |
167 | "cvsps": (has_cvsps, "cvsps utility"), |
|
176 | "cvsps": (has_cvsps, "cvsps utility"), | |
168 | "darcs": (has_darcs, "darcs client"), |
|
177 | "darcs": (has_darcs, "darcs client"), |
@@ -80,6 +80,34 b' mtn add --quiet -R dir2/dir' | |||||
80 | mtn ci -m emptydir |
|
80 | mtn ci -m emptydir | |
81 | mtn drop -R dir2/dir |
|
81 | mtn drop -R dir2/dir | |
82 | mtn ci -m dropdirectory |
|
82 | mtn ci -m dropdirectory | |
|
83 | echo '% test directory and file move' | |||
|
84 | mkdir -p dir3/d1 | |||
|
85 | echo a > dir3/a | |||
|
86 | mtn add dir3/a dir3/d1 | |||
|
87 | mtn ci -m dirfilemove | |||
|
88 | mtn mv dir3/a dir3/d1/a | |||
|
89 | mtn mv dir3/d1 dir3/d2 | |||
|
90 | mtn ci -m dirfilemove2 | |||
|
91 | echo '% test directory move into another directory move' | |||
|
92 | mkdir dir4 | |||
|
93 | mkdir dir5 | |||
|
94 | echo a > dir4/a | |||
|
95 | mtn add dir4/a dir5 | |||
|
96 | mtn ci -m dirdirmove | |||
|
97 | mtn mv dir5 dir6 | |||
|
98 | mtn mv dir4 dir6/dir4 | |||
|
99 | mtn ci -m dirdirmove2 | |||
|
100 | echo '% test diverging directory moves' | |||
|
101 | mkdir -p dir7/dir9/dir8 | |||
|
102 | echo a > dir7/dir9/dir8/a | |||
|
103 | echo b > dir7/dir9/b | |||
|
104 | echo c > dir7/c | |||
|
105 | mtn add -R dir7 | |||
|
106 | mtn ci -m divergentdirmove | |||
|
107 | mtn mv dir7 dir7-2 | |||
|
108 | mtn mv dir7-2/dir9 dir9-2 | |||
|
109 | mtn mv dir9-2/dir8 dir8-2 | |||
|
110 | mtn ci -m divergentdirmove2 | |||
83 | cd .. |
|
111 | cd .. | |
84 |
|
112 | |||
85 | echo % convert incrementally |
|
113 | echo % convert incrementally | |
@@ -108,5 +136,11 b" test -d dir1/subdir1 && echo 'renamed di" | |||||
108 | hg log -v -C -r 4 | grep copies |
|
136 | hg log -v -C -r 4 | grep copies | |
109 | echo % check file remove with directory move |
|
137 | echo % check file remove with directory move | |
110 | hg manifest -r 5 |
|
138 | hg manifest -r 5 | |
|
139 | echo % check file move with directory move | |||
|
140 | hg manifest -r 9 | |||
|
141 | echo % check file directory directory move | |||
|
142 | hg manifest -r 11 | |||
|
143 | echo % check divergent directory moves | |||
|
144 | hg manifest -r 13 | |||
111 | exit 0 |
|
145 | exit 0 | |
112 |
|
146 |
@@ -53,19 +53,74 b' mtn: dropping dir2/dir/emptydir from wor' | |||||
53 | mtn: dropping dir2/dir from workspace manifest |
|
53 | mtn: dropping dir2/dir from workspace manifest | |
54 | mtn: beginning commit on branch 'com.selenic.test' |
|
54 | mtn: beginning commit on branch 'com.selenic.test' | |
55 | mtn: committed revision 2323d4bc324e6c82628dc04d47a9fd32ad24e322 |
|
55 | mtn: committed revision 2323d4bc324e6c82628dc04d47a9fd32ad24e322 | |
|
56 | % test directory and file move | |||
|
57 | mtn: adding dir3 to workspace manifest | |||
|
58 | mtn: adding dir3/a to workspace manifest | |||
|
59 | mtn: adding dir3/d1 to workspace manifest | |||
|
60 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
61 | mtn: committed revision 47b192f720faa622f48c68d1eb075b26d405aa8b | |||
|
62 | mtn: skipping dir3/d1, already accounted for in workspace | |||
|
63 | mtn: renaming dir3/a to dir3/d1/a in workspace manifest | |||
|
64 | mtn: skipping dir3, already accounted for in workspace | |||
|
65 | mtn: renaming dir3/d1 to dir3/d2 in workspace manifest | |||
|
66 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
67 | mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632 | |||
|
68 | % test directory move into another directory move | |||
|
69 | mtn: adding dir4 to workspace manifest | |||
|
70 | mtn: adding dir4/a to workspace manifest | |||
|
71 | mtn: adding dir5 to workspace manifest | |||
|
72 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
73 | mtn: committed revision 466e0b2afc7a55aa2b4ab2f57cb240bb6cd66fc7 | |||
|
74 | mtn: renaming dir5 to dir6 in workspace manifest | |||
|
75 | mtn: skipping dir6, already accounted for in workspace | |||
|
76 | mtn: renaming dir4 to dir6/dir4 in workspace manifest | |||
|
77 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
78 | mtn: committed revision 3d1f77ebad0c23a5d14911be3b670f990991b749 | |||
|
79 | % test diverging directory moves | |||
|
80 | mtn: adding dir7 to workspace manifest | |||
|
81 | mtn: adding dir7/c to workspace manifest | |||
|
82 | mtn: adding dir7/dir9 to workspace manifest | |||
|
83 | mtn: adding dir7/dir9/b to workspace manifest | |||
|
84 | mtn: adding dir7/dir9/dir8 to workspace manifest | |||
|
85 | mtn: adding dir7/dir9/dir8/a to workspace manifest | |||
|
86 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
87 | mtn: committed revision 08a08511f18b428d840199b062de90d0396bc2ed | |||
|
88 | mtn: renaming dir7 to dir7-2 in workspace manifest | |||
|
89 | mtn: renaming dir7-2/dir9 to dir9-2 in workspace manifest | |||
|
90 | mtn: renaming dir9-2/dir8 to dir8-2 in workspace manifest | |||
|
91 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
92 | mtn: committed revision 4a736634505795f17786fffdf2c9cbf5b11df6f6 | |||
56 | % convert incrementally |
|
93 | % convert incrementally | |
57 | assuming destination repo.mtn-hg |
|
94 | assuming destination repo.mtn-hg | |
58 | scanning source... |
|
95 | scanning source... | |
59 | sorting... |
|
96 | sorting... | |
60 | converting... |
|
97 | converting... | |
61 |
|
|
98 | 11 update2 "with" quotes | |
62 |
|
|
99 | 10 createdir1 | |
63 |
|
|
100 | 9 movedir1 | |
64 |
|
|
101 | 8 movedir | |
65 |
|
|
102 | 7 emptydir | |
66 |
|
|
103 | 6 dropdirectory | |
67 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
104 | 5 dirfilemove | |
68 | @ 7 "dropdirectory" files: dir2/dir/subdir/f |
|
105 | 4 dirfilemove2 | |
|
106 | 3 dirdirmove | |||
|
107 | 2 dirdirmove2 | |||
|
108 | 1 divergentdirmove | |||
|
109 | 0 divergentdirmove2 | |||
|
110 | 11 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
111 | @ 13 "divergentdirmove2" files: dir7-2/c dir7/c dir7/dir9/b dir7/dir9/dir8/a dir8-2/a dir9-2/b | |||
|
112 | | | |||
|
113 | o 12 "divergentdirmove" files: dir7/c dir7/dir9/b dir7/dir9/dir8/a | |||
|
114 | | | |||
|
115 | o 11 "dirdirmove2" files: dir4/a dir6/dir4/a | |||
|
116 | | | |||
|
117 | o 10 "dirdirmove" files: dir4/a | |||
|
118 | | | |||
|
119 | o 9 "dirfilemove2" files: dir3/a dir3/d2/a | |||
|
120 | | | |||
|
121 | o 8 "dirfilemove" files: dir3/a | |||
|
122 | | | |||
|
123 | o 7 "dropdirectory" files: dir2/dir/subdir/f | |||
69 | | |
|
124 | | | |
70 | o 6 "emptydir" files: dir2/dir/subdir/f |
|
125 | o 6 "emptydir" files: dir2/dir/subdir/f | |
71 | | |
|
126 | | | |
@@ -87,6 +142,11 b' dir1/subdir2/file1' | |||||
87 | dir1/subdir2_other/file1 |
|
142 | dir1/subdir2_other/file1 | |
88 | dir2/a |
|
143 | dir2/a | |
89 | dir2/newfile |
|
144 | dir2/newfile | |
|
145 | dir3/d2/a | |||
|
146 | dir6/dir4/a | |||
|
147 | dir7-2/c | |||
|
148 | dir8-2/a | |||
|
149 | dir9-2/b | |||
90 | e |
|
150 | e | |
91 | % contents |
|
151 | % contents | |
92 | a |
|
152 | a | |
@@ -108,3 +168,32 b' dir1/subdir2_other/file1' | |||||
108 | dir2/a |
|
168 | dir2/a | |
109 | dir2/newfile |
|
169 | dir2/newfile | |
110 | e |
|
170 | e | |
|
171 | % check file move with directory move | |||
|
172 | bin2 | |||
|
173 | dir1/subdir2/file1 | |||
|
174 | dir1/subdir2_other/file1 | |||
|
175 | dir2/a | |||
|
176 | dir2/newfile | |||
|
177 | dir3/d2/a | |||
|
178 | e | |||
|
179 | % check file directory directory move | |||
|
180 | bin2 | |||
|
181 | dir1/subdir2/file1 | |||
|
182 | dir1/subdir2_other/file1 | |||
|
183 | dir2/a | |||
|
184 | dir2/newfile | |||
|
185 | dir3/d2/a | |||
|
186 | dir6/dir4/a | |||
|
187 | e | |||
|
188 | % check divergent directory moves | |||
|
189 | bin2 | |||
|
190 | dir1/subdir2/file1 | |||
|
191 | dir1/subdir2_other/file1 | |||
|
192 | dir2/a | |||
|
193 | dir2/newfile | |||
|
194 | dir3/d2/a | |||
|
195 | dir6/dir4/a | |||
|
196 | dir7-2/c | |||
|
197 | dir8-2/a | |||
|
198 | dir9-2/b | |||
|
199 | e |
General Comments 0
You need to be logged in to leave comments.
Login now