Show More
@@ -409,3 +409,6 b' class filemap_source(converter_source):' | |||||
409 |
|
409 | |||
410 | def getbookmarks(self): |
|
410 | def getbookmarks(self): | |
411 | return self.base.getbookmarks() |
|
411 | return self.base.getbookmarks() | |
|
412 | ||||
|
413 | def converted(self, rev, sinkrev): | |||
|
414 | self.base.converted(rev, sinkrev) |
@@ -122,3 +122,271 b' test tag rewriting' | |||||
122 | tip 2:6f4fd1df87fb |
|
122 | tip 2:6f4fd1df87fb | |
123 | some-tag 0:ba8636729451 |
|
123 | some-tag 0:ba8636729451 | |
124 | $ cd .. |
|
124 | $ cd .. | |
|
125 | ||||
|
126 | ||||
|
127 | Test cases for hg-hg roundtrip | |||
|
128 | ||||
|
129 | Helper | |||
|
130 | ||||
|
131 | $ glog() | |||
|
132 | > { | |||
|
133 | > hg log -G --template '{rev} {node|short} "{desc}" files: {files}\n' $* | |||
|
134 | > } | |||
|
135 | ||||
|
136 | Create a tricky source repo | |||
|
137 | ||||
|
138 | $ hg init source | |||
|
139 | $ cd source | |||
|
140 | ||||
|
141 | $ echo 0 > 0 | |||
|
142 | $ hg ci -Aqm '0: add 0' | |||
|
143 | $ echo a > a | |||
|
144 | $ mkdir dir | |||
|
145 | $ echo b > dir/b | |||
|
146 | $ hg ci -qAm '1: add a and dir/b' | |||
|
147 | $ echo c > dir/c | |||
|
148 | $ hg ci -qAm '2: add dir/c' | |||
|
149 | $ hg copy a e | |||
|
150 | $ echo b >> b | |||
|
151 | $ hg ci -qAm '3: copy a to e, change b' | |||
|
152 | $ hg up -qr -3 | |||
|
153 | $ echo a >> a | |||
|
154 | $ hg ci -qAm '4: change a' | |||
|
155 | $ hg merge | |||
|
156 | merging a and e to e | |||
|
157 | 2 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
158 | (branch merge, don't forget to commit) | |||
|
159 | $ hg copy b dir/d | |||
|
160 | $ hg ci -qAm '5: merge 2 and 3, copy b to dir/d' | |||
|
161 | $ echo a >> a | |||
|
162 | $ hg ci -qAm '6: change a' | |||
|
163 | ||||
|
164 | $ hg mani | |||
|
165 | 0 | |||
|
166 | a | |||
|
167 | b | |||
|
168 | dir/b | |||
|
169 | dir/c | |||
|
170 | dir/d | |||
|
171 | e | |||
|
172 | $ glog | |||
|
173 | @ 6 0613c8e59a3d "6: change a" files: a | |||
|
174 | | | |||
|
175 | o 5 717e9b37cdb7 "5: merge 2 and 3, copy b to dir/d" files: dir/d e | |||
|
176 | |\ | |||
|
177 | | o 4 86a55cb968d5 "4: change a" files: a | |||
|
178 | | | | |||
|
179 | o | 3 0e6e235919dd "3: copy a to e, change b" files: b e | |||
|
180 | | | | |||
|
181 | o | 2 0394b0d5e4f7 "2: add dir/c" files: dir/c | |||
|
182 | |/ | |||
|
183 | o 1 333546584845 "1: add a and dir/b" files: a dir/b | |||
|
184 | | | |||
|
185 | o 0 d1a24e2ebd23 "0: add 0" files: 0 | |||
|
186 | ||||
|
187 | $ cd .. | |||
|
188 | ||||
|
189 | Convert excluding rev 0 and dir/ (and thus rev2): | |||
|
190 | ||||
|
191 | $ cat << EOF > filemap | |||
|
192 | > exclude dir | |||
|
193 | > EOF | |||
|
194 | ||||
|
195 | $ hg convert --filemap filemap source dest --config convert.hg.revs=1:: | |||
|
196 | initializing destination dest repository | |||
|
197 | scanning source... | |||
|
198 | sorting... | |||
|
199 | converting... | |||
|
200 | 5 1: add a and dir/b | |||
|
201 | 4 2: add dir/c | |||
|
202 | 3 3: copy a to e, change b | |||
|
203 | 2 4: change a | |||
|
204 | 1 5: merge 2 and 3, copy b to dir/d | |||
|
205 | 0 6: change a | |||
|
206 | ||||
|
207 | Verify that conversion skipped rev 2: | |||
|
208 | ||||
|
209 | $ glog -R dest | |||
|
210 | o 4 78814e84a217 "6: change a" files: a | |||
|
211 | | | |||
|
212 | o 3 f7cff662c5e5 "5: merge 2 and 3, copy b to dir/d" files: e | |||
|
213 | |\ | |||
|
214 | | o 2 ab40a95b0072 "4: change a" files: a | |||
|
215 | | | | |||
|
216 | o | 1 bd51f17597bf "3: copy a to e, change b" files: b e | |||
|
217 | |/ | |||
|
218 | o 0 a4a1dae0fe35 "1: add a and dir/b" files: 0 a | |||
|
219 | ||||
|
220 | ||||
|
221 | Verify mapping correct in both directions: | |||
|
222 | ||||
|
223 | $ cat source/.hg/shamap | |||
|
224 | a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5 333546584845f70c4cfecb992341aaef0e708166 | |||
|
225 | bd51f17597bf32268e68a560b206898c3960cda2 0e6e235919dd8e9285ba8eb5adf703af9ad99378 | |||
|
226 | ab40a95b00725307e79c2fd271000aa8af9759f4 86a55cb968d51770cba2a1630d6cc637b574580a | |||
|
227 | f7cff662c5e581e6f3f1a85ffdd2bcb35825f6ba 717e9b37cdb7eb9917ca8e30aa3f986e6d5b177d | |||
|
228 | 78814e84a217894517c2de392b903ed05e6871a4 0613c8e59a3ddb9789072ef52f1ed13496489bb4 | |||
|
229 | $ cat dest/.hg/shamap | |||
|
230 | 333546584845f70c4cfecb992341aaef0e708166 a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5 | |||
|
231 | 0394b0d5e4f761ced559fd0bbdc6afc16cb3f7d1 a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5 | |||
|
232 | 0e6e235919dd8e9285ba8eb5adf703af9ad99378 bd51f17597bf32268e68a560b206898c3960cda2 | |||
|
233 | 86a55cb968d51770cba2a1630d6cc637b574580a ab40a95b00725307e79c2fd271000aa8af9759f4 | |||
|
234 | 717e9b37cdb7eb9917ca8e30aa3f986e6d5b177d f7cff662c5e581e6f3f1a85ffdd2bcb35825f6ba | |||
|
235 | 0613c8e59a3ddb9789072ef52f1ed13496489bb4 78814e84a217894517c2de392b903ed05e6871a4 | |||
|
236 | ||||
|
237 | Verify meta data converted correctly: | |||
|
238 | ||||
|
239 | $ hg -R dest log -r 1 --debug -p --git | |||
|
240 | changeset: 1:bd51f17597bf32268e68a560b206898c3960cda2 | |||
|
241 | phase: draft | |||
|
242 | parent: 0:a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5 | |||
|
243 | parent: -1:0000000000000000000000000000000000000000 | |||
|
244 | manifest: 1:040c72ed9b101773c24ac314776bfc846943781f | |||
|
245 | user: test | |||
|
246 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
247 | files+: b e | |||
|
248 | extra: branch=default | |||
|
249 | description: | |||
|
250 | 3: copy a to e, change b | |||
|
251 | ||||
|
252 | ||||
|
253 | diff --git a/b b/b | |||
|
254 | new file mode 100644 | |||
|
255 | --- /dev/null | |||
|
256 | +++ b/b | |||
|
257 | @@ -0,0 +1,1 @@ | |||
|
258 | +b | |||
|
259 | diff --git a/a b/e | |||
|
260 | copy from a | |||
|
261 | copy to e | |||
|
262 | ||||
|
263 | Verify files included and excluded correctly: | |||
|
264 | ||||
|
265 | $ hg -R dest manifest -r tip | |||
|
266 | 0 | |||
|
267 | a | |||
|
268 | b | |||
|
269 | e | |||
|
270 | ||||
|
271 | ||||
|
272 | Make changes in dest and convert back: | |||
|
273 | ||||
|
274 | $ hg -R dest up -q | |||
|
275 | $ echo dest > dest/dest | |||
|
276 | $ hg -R dest ci -Aqm 'change in dest' | |||
|
277 | $ hg -R dest tip | |||
|
278 | changeset: 5:a2e0e3cc6d1d | |||
|
279 | tag: tip | |||
|
280 | user: test | |||
|
281 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
282 | summary: change in dest | |||
|
283 | ||||
|
284 | ||||
|
285 | (converting merges back after using a filemap will probably cause chaos so we | |||
|
286 | exclude merges.) | |||
|
287 | ||||
|
288 | $ hg convert dest source --config convert.hg.revs='!merge()' | |||
|
289 | scanning source... | |||
|
290 | sorting... | |||
|
291 | converting... | |||
|
292 | 0 change in dest | |||
|
293 | ||||
|
294 | Verify the conversion back: | |||
|
295 | ||||
|
296 | $ hg -R source log --debug -r tip | |||
|
297 | changeset: 7:e6d364a69ff1248b2099e603b0c145504cade6f0 | |||
|
298 | tag: tip | |||
|
299 | phase: draft | |||
|
300 | parent: 6:0613c8e59a3ddb9789072ef52f1ed13496489bb4 | |||
|
301 | parent: -1:0000000000000000000000000000000000000000 | |||
|
302 | manifest: 7:aa3e9542f3b76d4f1f1b2e9c7ce9dbb48b6a95ec | |||
|
303 | user: test | |||
|
304 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
305 | files+: dest | |||
|
306 | extra: branch=default | |||
|
307 | description: | |||
|
308 | change in dest | |||
|
309 | ||||
|
310 | ||||
|
311 | Files that had been excluded are still present: | |||
|
312 | ||||
|
313 | $ hg -R source manifest -r tip | |||
|
314 | 0 | |||
|
315 | a | |||
|
316 | b | |||
|
317 | dest | |||
|
318 | dir/b | |||
|
319 | dir/c | |||
|
320 | dir/d | |||
|
321 | e | |||
|
322 | ||||
|
323 | More source changes | |||
|
324 | ||||
|
325 | $ cd source | |||
|
326 | $ echo 1 >> a | |||
|
327 | $ hg ci -m '8: source first branch' | |||
|
328 | created new head | |||
|
329 | $ hg up -qr -2 | |||
|
330 | $ echo 2 >> a | |||
|
331 | $ hg ci -m '9: source second branch' | |||
|
332 | $ hg merge -q --tool internal:local | |||
|
333 | $ hg ci -m '10: source merge' | |||
|
334 | $ echo >> a | |||
|
335 | $ hg ci -m '11: source change' | |||
|
336 | ||||
|
337 | $ hg mani | |||
|
338 | 0 | |||
|
339 | a | |||
|
340 | b | |||
|
341 | dest | |||
|
342 | dir/b | |||
|
343 | dir/c | |||
|
344 | dir/d | |||
|
345 | e | |||
|
346 | ||||
|
347 | $ glog -r 6: | |||
|
348 | @ 11 0c8927d1f7f4 "11: source change" files: a | |||
|
349 | | | |||
|
350 | o 10 9ccb7ee8d261 "10: source merge" files: a | |||
|
351 | |\ | |||
|
352 | | o 9 f131b1518dba "9: source second branch" files: a | |||
|
353 | | | | |||
|
354 | o | 8 669cf0e74b50 "8: source first branch" files: a | |||
|
355 | | | | |||
|
356 | | o 7 e6d364a69ff1 "change in dest" files: dest | |||
|
357 | |/ | |||
|
358 | o 6 0613c8e59a3d "6: change a" files: a | |||
|
359 | | | |||
|
360 | $ cd .. | |||
|
361 | ||||
|
362 | $ hg convert --filemap filemap source dest --config convert.hg.revs=3: | |||
|
363 | scanning source... | |||
|
364 | sorting... | |||
|
365 | converting... | |||
|
366 | 3 8: source first branch | |||
|
367 | 2 9: source second branch | |||
|
368 | 1 10: source merge | |||
|
369 | 0 11: source change | |||
|
370 | ||||
|
371 | $ glog -R dest | |||
|
372 | o 9 8432d597b263 "11: source change" files: a | |||
|
373 | | | |||
|
374 | o 8 632ffacdcd6f "10: source merge" files: a | |||
|
375 | |\ | |||
|
376 | | o 7 049cfee90ee6 "9: source second branch" files: a | |||
|
377 | | | | |||
|
378 | o | 6 9b6845e036e5 "8: source first branch" files: a | |||
|
379 | | | | |||
|
380 | | @ 5 a2e0e3cc6d1d "change in dest" files: dest | |||
|
381 | |/ | |||
|
382 | o 4 78814e84a217 "6: change a" files: a | |||
|
383 | | | |||
|
384 | o 3 f7cff662c5e5 "5: merge 2 and 3, copy b to dir/d" files: e | |||
|
385 | |\ | |||
|
386 | | o 2 ab40a95b0072 "4: change a" files: a | |||
|
387 | | | | |||
|
388 | o | 1 bd51f17597bf "3: copy a to e, change b" files: b e | |||
|
389 | |/ | |||
|
390 | o 0 a4a1dae0fe35 "1: add a and dir/b" files: 0 a | |||
|
391 | ||||
|
392 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now