##// END OF EJS Templates
tests: pass only one file at a time to tail(1)...
Augie Fackler -
r32066:40cf693f stable
parent child Browse files
Show More
@@ -1,565 +1,562
1 1
2 2 $ cat >> $HGRCPATH <<EOF
3 3 > [extensions]
4 4 > convert=
5 5 > [convert]
6 6 > hg.saverev=False
7 7 > EOF
8 8 $ hg init orig
9 9 $ cd orig
10 10 $ echo foo > foo
11 11 $ echo bar > bar
12 12 $ hg ci -qAm 'add foo and bar'
13 13 $ hg rm foo
14 14 $ hg ci -m 'remove foo'
15 15 $ mkdir foo
16 16 $ echo file > foo/file
17 17 $ hg ci -qAm 'add foo/file'
18 18 $ hg tag some-tag
19 19 $ hg tag -l local-tag
20 20 $ hg log
21 21 changeset: 3:593cbf6fb2b4
22 22 tag: local-tag
23 23 tag: tip
24 24 user: test
25 25 date: Thu Jan 01 00:00:00 1970 +0000
26 26 summary: Added tag some-tag for changeset ad681a868e44
27 27
28 28 changeset: 2:ad681a868e44
29 29 tag: some-tag
30 30 user: test
31 31 date: Thu Jan 01 00:00:00 1970 +0000
32 32 summary: add foo/file
33 33
34 34 changeset: 1:cbba8ecc03b7
35 35 user: test
36 36 date: Thu Jan 01 00:00:00 1970 +0000
37 37 summary: remove foo
38 38
39 39 changeset: 0:327daa9251fa
40 40 user: test
41 41 date: Thu Jan 01 00:00:00 1970 +0000
42 42 summary: add foo and bar
43 43
44 44 $ hg phase --public -r tip
45 45 $ cd ..
46 46 $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
47 47 initializing destination new repository
48 48 scanning source...
49 49 sorting...
50 50 converting...
51 51 3 add foo and bar
52 52 2 remove foo
53 53 1 add foo/file
54 54 0 Added tag some-tag for changeset ad681a868e44
55 55 $ cd new
56 56 $ hg log -G --template '{rev} {node|short} ({phase}) "{desc}"\n'
57 57 o 3 593cbf6fb2b4 (public) "Added tag some-tag for changeset ad681a868e44"
58 58 |
59 59 o 2 ad681a868e44 (public) "add foo/file"
60 60 |
61 61 o 1 cbba8ecc03b7 (public) "remove foo"
62 62 |
63 63 o 0 327daa9251fa (public) "add foo and bar"
64 64
65 65
66 66 $ hg out ../orig
67 67 comparing with ../orig
68 68 searching for changes
69 69 no changes found
70 70 [1]
71 71
72 72 dirstate should be empty:
73 73
74 74 $ hg debugstate
75 75 $ hg parents -q
76 76 $ hg up -C
77 77 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 78 $ hg copy bar baz
79 79
80 80 put something in the dirstate:
81 81
82 82 $ hg debugstate > debugstate
83 83 $ grep baz debugstate
84 84 a 0 -1 unset baz
85 85 copy: bar -> baz
86 86
87 87 add a new revision in the original repo
88 88
89 89 $ cd ../orig
90 90 $ echo baz > baz
91 91 $ hg ci -qAm 'add baz'
92 92 $ cd ..
93 93 $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
94 94 scanning source...
95 95 sorting...
96 96 converting...
97 97 0 add baz
98 98 $ cd new
99 99 $ hg out ../orig
100 100 comparing with ../orig
101 101 searching for changes
102 102 no changes found
103 103 [1]
104 104
105 105 dirstate should be the same (no output below):
106 106
107 107 $ hg debugstate > new-debugstate
108 108 $ diff debugstate new-debugstate
109 109
110 110 no copies
111 111
112 112 $ hg up -C
113 113 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
114 114 $ hg debugrename baz
115 115 baz not renamed
116 116 $ cd ..
117 117
118 118 test tag rewriting
119 119
120 120 $ cat > filemap <<EOF
121 121 > exclude foo
122 122 > EOF
123 123 $ hg convert --filemap filemap orig new-filemap 2>&1 | grep -v 'subversion python bindings could not be loaded'
124 124 initializing destination new-filemap repository
125 125 scanning source...
126 126 sorting...
127 127 converting...
128 128 4 add foo and bar
129 129 3 remove foo
130 130 2 add foo/file
131 131 1 Added tag some-tag for changeset ad681a868e44
132 132 0 add baz
133 133 $ cd new-filemap
134 134 $ hg tags
135 135 tip 2:3c74706b1ff8
136 136 some-tag 0:ba8636729451
137 137 $ cd ..
138 138
139 139
140 140 Test cases for hg-hg roundtrip
141 141
142 142 Helper
143 143
144 144 $ glog()
145 145 > {
146 146 > hg log -G --template '{rev} {node|short} ({phase}) "{desc}" files: {files}\n' $*
147 147 > }
148 148
149 149 Create a tricky source repo
150 150
151 151 $ hg init source
152 152 $ cd source
153 153
154 154 $ echo 0 > 0
155 155 $ hg ci -Aqm '0: add 0'
156 156 $ echo a > a
157 157 $ mkdir dir
158 158 $ echo b > dir/b
159 159 $ hg ci -qAm '1: add a and dir/b'
160 160 $ echo c > dir/c
161 161 $ hg ci -qAm '2: add dir/c'
162 162 $ hg copy a e
163 163 $ echo b >> b
164 164 $ hg ci -qAm '3: copy a to e, change b'
165 165 $ hg up -qr -3
166 166 $ echo a >> a
167 167 $ hg ci -qAm '4: change a'
168 168 $ hg merge
169 169 merging a and e to e
170 170 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
171 171 (branch merge, don't forget to commit)
172 172 $ hg copy b dir/d
173 173 $ hg ci -qAm '5: merge 2 and 3, copy b to dir/d'
174 174 $ echo a >> a
175 175 $ hg ci -qAm '6: change a'
176 176
177 177 $ hg mani
178 178 0
179 179 a
180 180 b
181 181 dir/b
182 182 dir/c
183 183 dir/d
184 184 e
185 185 $ hg phase --public -r tip
186 186 $ glog
187 187 @ 6 0613c8e59a3d (public) "6: change a" files: a
188 188 |
189 189 o 5 717e9b37cdb7 (public) "5: merge 2 and 3, copy b to dir/d" files: dir/d e
190 190 |\
191 191 | o 4 86a55cb968d5 (public) "4: change a" files: a
192 192 | |
193 193 o | 3 0e6e235919dd (public) "3: copy a to e, change b" files: b e
194 194 | |
195 195 o | 2 0394b0d5e4f7 (public) "2: add dir/c" files: dir/c
196 196 |/
197 197 o 1 333546584845 (public) "1: add a and dir/b" files: a dir/b
198 198 |
199 199 o 0 d1a24e2ebd23 (public) "0: add 0" files: 0
200 200
201 201 $ cd ..
202 202
203 203 Convert excluding rev 0 and dir/ (and thus rev2):
204 204
205 205 $ cat << EOF > filemap
206 206 > exclude dir
207 207 > EOF
208 208
209 209 $ hg convert --filemap filemap source dest --config convert.hg.revs=1::
210 210 initializing destination dest repository
211 211 scanning source...
212 212 sorting...
213 213 converting...
214 214 5 1: add a and dir/b
215 215 4 2: add dir/c
216 216 3 3: copy a to e, change b
217 217 2 4: change a
218 218 1 5: merge 2 and 3, copy b to dir/d
219 219 0 6: change a
220 220
221 221 Verify that conversion skipped rev 2:
222 222
223 223 $ glog -R dest
224 224 o 4 78814e84a217 (draft) "6: change a" files: a
225 225 |
226 226 o 3 f7cff662c5e5 (draft) "5: merge 2 and 3, copy b to dir/d" files: e
227 227 |\
228 228 | o 2 ab40a95b0072 (draft) "4: change a" files: a
229 229 | |
230 230 o | 1 bd51f17597bf (draft) "3: copy a to e, change b" files: b e
231 231 |/
232 232 o 0 a4a1dae0fe35 (draft) "1: add a and dir/b" files: 0 a
233 233
234 234
235 235 Verify mapping correct in both directions:
236 236
237 237 $ cat source/.hg/shamap
238 238 a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5 333546584845f70c4cfecb992341aaef0e708166
239 239 bd51f17597bf32268e68a560b206898c3960cda2 0e6e235919dd8e9285ba8eb5adf703af9ad99378
240 240 ab40a95b00725307e79c2fd271000aa8af9759f4 86a55cb968d51770cba2a1630d6cc637b574580a
241 241 f7cff662c5e581e6f3f1a85ffdd2bcb35825f6ba 717e9b37cdb7eb9917ca8e30aa3f986e6d5b177d
242 242 78814e84a217894517c2de392b903ed05e6871a4 0613c8e59a3ddb9789072ef52f1ed13496489bb4
243 243 $ cat dest/.hg/shamap
244 244 333546584845f70c4cfecb992341aaef0e708166 a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5
245 245 0394b0d5e4f761ced559fd0bbdc6afc16cb3f7d1 a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5
246 246 0e6e235919dd8e9285ba8eb5adf703af9ad99378 bd51f17597bf32268e68a560b206898c3960cda2
247 247 86a55cb968d51770cba2a1630d6cc637b574580a ab40a95b00725307e79c2fd271000aa8af9759f4
248 248 717e9b37cdb7eb9917ca8e30aa3f986e6d5b177d f7cff662c5e581e6f3f1a85ffdd2bcb35825f6ba
249 249 0613c8e59a3ddb9789072ef52f1ed13496489bb4 78814e84a217894517c2de392b903ed05e6871a4
250 250
251 251 Verify meta data converted correctly:
252 252
253 253 $ hg -R dest log -r 1 --debug -p --git
254 254 changeset: 1:bd51f17597bf32268e68a560b206898c3960cda2
255 255 phase: draft
256 256 parent: 0:a4a1dae0fe3514cefd9b8541b7abbc8f44f946d5
257 257 parent: -1:0000000000000000000000000000000000000000
258 258 manifest: 1:040c72ed9b101773c24ac314776bfc846943781f
259 259 user: test
260 260 date: Thu Jan 01 00:00:00 1970 +0000
261 261 files+: b e
262 262 extra: branch=default
263 263 description:
264 264 3: copy a to e, change b
265 265
266 266
267 267 diff --git a/b b/b
268 268 new file mode 100644
269 269 --- /dev/null
270 270 +++ b/b
271 271 @@ -0,0 +1,1 @@
272 272 +b
273 273 diff --git a/a b/e
274 274 copy from a
275 275 copy to e
276 276
277 277 Verify files included and excluded correctly:
278 278
279 279 $ hg -R dest manifest -r tip
280 280 0
281 281 a
282 282 b
283 283 e
284 284
285 285
286 286 Make changes in dest and convert back:
287 287
288 288 $ hg -R dest up -q
289 289 $ echo dest > dest/dest
290 290 $ hg -R dest ci -Aqm 'change in dest'
291 291 $ hg -R dest tip
292 292 changeset: 5:a2e0e3cc6d1d
293 293 tag: tip
294 294 user: test
295 295 date: Thu Jan 01 00:00:00 1970 +0000
296 296 summary: change in dest
297 297
298 298
299 299 (converting merges back after using a filemap will probably cause chaos so we
300 300 exclude merges.)
301 301
302 302 $ hg convert dest source --config convert.hg.revs='!merge()'
303 303 scanning source...
304 304 sorting...
305 305 converting...
306 306 0 change in dest
307 307
308 308 Verify the conversion back:
309 309
310 310 $ hg -R source log --debug -r tip
311 311 changeset: 7:e6d364a69ff1248b2099e603b0c145504cade6f0
312 312 tag: tip
313 313 phase: draft
314 314 parent: 6:0613c8e59a3ddb9789072ef52f1ed13496489bb4
315 315 parent: -1:0000000000000000000000000000000000000000
316 316 manifest: 7:aa3e9542f3b76d4f1f1b2e9c7ce9dbb48b6a95ec
317 317 user: test
318 318 date: Thu Jan 01 00:00:00 1970 +0000
319 319 files+: dest
320 320 extra: branch=default
321 321 description:
322 322 change in dest
323 323
324 324
325 325 Files that had been excluded are still present:
326 326
327 327 $ hg -R source manifest -r tip
328 328 0
329 329 a
330 330 b
331 331 dest
332 332 dir/b
333 333 dir/c
334 334 dir/d
335 335 e
336 336
337 337 More source changes
338 338
339 339 $ cd source
340 340 $ echo 1 >> a
341 341 $ hg ci -m '8: source first branch'
342 342 created new head
343 343 $ hg up -qr -2
344 344 $ echo 2 >> a
345 345 $ hg ci -m '9: source second branch'
346 346 $ hg merge -q --tool internal:local
347 347 $ hg ci -m '10: source merge'
348 348 $ echo >> a
349 349 $ hg ci -m '11: source change'
350 350
351 351 $ hg mani
352 352 0
353 353 a
354 354 b
355 355 dest
356 356 dir/b
357 357 dir/c
358 358 dir/d
359 359 e
360 360
361 361 $ glog -r 6:
362 362 @ 11 0c8927d1f7f4 (draft) "11: source change" files: a
363 363 |
364 364 o 10 9ccb7ee8d261 (draft) "10: source merge" files: a
365 365 |\
366 366 | o 9 f131b1518dba (draft) "9: source second branch" files: a
367 367 | |
368 368 o | 8 669cf0e74b50 (draft) "8: source first branch" files: a
369 369 | |
370 370 | o 7 e6d364a69ff1 (draft) "change in dest" files: dest
371 371 |/
372 372 o 6 0613c8e59a3d (public) "6: change a" files: a
373 373 |
374 374 ~
375 375 $ cd ..
376 376
377 377 $ hg convert --filemap filemap source dest --config convert.hg.revs=3:
378 378 scanning source...
379 379 sorting...
380 380 converting...
381 381 3 8: source first branch
382 382 2 9: source second branch
383 383 1 10: source merge
384 384 0 11: source change
385 385
386 386 $ glog -R dest
387 387 o 9 8432d597b263 (draft) "11: source change" files: a
388 388 |
389 389 o 8 632ffacdcd6f (draft) "10: source merge" files: a
390 390 |\
391 391 | o 7 049cfee90ee6 (draft) "9: source second branch" files: a
392 392 | |
393 393 o | 6 9b6845e036e5 (draft) "8: source first branch" files: a
394 394 | |
395 395 | @ 5 a2e0e3cc6d1d (draft) "change in dest" files: dest
396 396 |/
397 397 o 4 78814e84a217 (draft) "6: change a" files: a
398 398 |
399 399 o 3 f7cff662c5e5 (draft) "5: merge 2 and 3, copy b to dir/d" files: e
400 400 |\
401 401 | o 2 ab40a95b0072 (draft) "4: change a" files: a
402 402 | |
403 403 o | 1 bd51f17597bf (draft) "3: copy a to e, change b" files: b e
404 404 |/
405 405 o 0 a4a1dae0fe35 (draft) "1: add a and dir/b" files: 0 a
406 406
407 407 $ cd ..
408 408
409 409 Two way tests
410 410
411 411 $ hg init 0
412 412 $ echo f > 0/f
413 413 $ echo a > 0/a-only
414 414 $ echo b > 0/b-only
415 415 $ hg -R 0 ci -Aqm0
416 416
417 417 $ cat << EOF > filemap-a
418 418 > exclude b-only
419 419 > EOF
420 420 $ cat << EOF > filemap-b
421 421 > exclude a-only
422 422 > EOF
423 423 $ hg convert --filemap filemap-a 0 a
424 424 initializing destination a repository
425 425 scanning source...
426 426 sorting...
427 427 converting...
428 428 0 0
429 429 $ hg -R a up -q
430 430 $ echo a > a/f
431 431 $ hg -R a ci -ma
432 432
433 433 $ hg convert --filemap filemap-b 0 b
434 434 initializing destination b repository
435 435 scanning source...
436 436 sorting...
437 437 converting...
438 438 0 0
439 439 $ hg -R b up -q
440 440 $ echo b > b/f
441 441 $ hg -R b ci -mb
442 442
443 $ tail */.hg/shamap
444 ==> 0/.hg/shamap <==
443 $ tail 0/.hg/shamap
445 444 86f3f774ffb682bffb5dc3c1d3b3da637cb9a0d6 8a028c7c77f6c7bd6d63bc3f02ca9f779eabf16a
446 445 dd9f218eb91fb857f2a62fe023e1d64a4e7812fe 8a028c7c77f6c7bd6d63bc3f02ca9f779eabf16a
447
448 ==> a/.hg/shamap <==
446 $ tail a/.hg/shamap
449 447 8a028c7c77f6c7bd6d63bc3f02ca9f779eabf16a 86f3f774ffb682bffb5dc3c1d3b3da637cb9a0d6
450
451 ==> b/.hg/shamap <==
448 $ tail b/.hg/shamap
452 449 8a028c7c77f6c7bd6d63bc3f02ca9f779eabf16a dd9f218eb91fb857f2a62fe023e1d64a4e7812fe
453 450
454 451 $ hg convert a 0
455 452 scanning source...
456 453 sorting...
457 454 converting...
458 455 0 a
459 456
460 457 $ hg convert b 0
461 458 scanning source...
462 459 sorting...
463 460 converting...
464 461 0 b
465 462
466 463 $ hg -R 0 log -G
467 464 o changeset: 2:637fbbbe96b6
468 465 | tag: tip
469 466 | parent: 0:8a028c7c77f6
470 467 | user: test
471 468 | date: Thu Jan 01 00:00:00 1970 +0000
472 469 | summary: b
473 470 |
474 471 | o changeset: 1:ec7b9c96e692
475 472 |/ user: test
476 473 | date: Thu Jan 01 00:00:00 1970 +0000
477 474 | summary: a
478 475 |
479 476 @ changeset: 0:8a028c7c77f6
480 477 user: test
481 478 date: Thu Jan 01 00:00:00 1970 +0000
482 479 summary: 0
483 480
484 481 $ hg convert --filemap filemap-b 0 a --config convert.hg.revs=1::
485 482 scanning source...
486 483 sorting...
487 484 converting...
488 485
489 486 $ hg -R 0 up -r1
490 487 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
491 488 $ echo f >> 0/f
492 489 $ hg -R 0 ci -mx
493 490
494 491 $ hg convert --filemap filemap-b 0 a --config convert.hg.revs=1::
495 492 scanning source...
496 493 sorting...
497 494 converting...
498 495 0 x
499 496
500 497 $ hg -R a log -G -T '{rev} {desc|firstline} ({files})\n'
501 498 o 2 x (f)
502 499 |
503 500 @ 1 a (f)
504 501 |
505 502 o 0 0 (a-only f)
506 503
507 504 $ hg -R a mani -r tip
508 505 a-only
509 506 f
510 507
511 508 An additional round, demonstrating that unchanged files don't get converted
512 509
513 510 $ echo f >> 0/f
514 511 $ echo f >> 0/a-only
515 512 $ hg -R 0 ci -m "extra f+a-only change"
516 513
517 514 $ hg convert --filemap filemap-b 0 a --config convert.hg.revs=1::
518 515 scanning source...
519 516 sorting...
520 517 converting...
521 518 0 extra f+a-only change
522 519
523 520 $ hg -R a log -G -T '{rev} {desc|firstline} ({files})\n'
524 521 o 3 extra f+a-only change (f)
525 522 |
526 523 o 2 x (f)
527 524 |
528 525 @ 1 a (f)
529 526 |
530 527 o 0 0 (a-only f)
531 528
532 529
533 530 Conversion after rollback
534 531
535 532 $ hg -R a rollback -f
536 533 repository tip rolled back to revision 2 (undo convert)
537 534
538 535 $ hg convert --filemap filemap-b 0 a --config convert.hg.revs=1::
539 536 scanning source...
540 537 sorting...
541 538 converting...
542 539 0 extra f+a-only change
543 540
544 541 $ hg -R a log -G -T '{rev} {desc|firstline} ({files})\n'
545 542 o 3 extra f+a-only change (f)
546 543 |
547 544 o 2 x (f)
548 545 |
549 546 @ 1 a (f)
550 547 |
551 548 o 0 0 (a-only f)
552 549
553 550 Convert with --full adds and removes files that didn't change
554 551
555 552 $ echo f >> 0/f
556 553 $ hg -R 0 ci -m "f"
557 554 $ hg convert --filemap filemap-b --full 0 a --config convert.hg.revs=1::
558 555 scanning source...
559 556 sorting...
560 557 converting...
561 558 0 f
562 559 $ hg -R a status --change tip
563 560 M f
564 561 A b-only
565 562 R a-only
General Comments 0
You need to be logged in to leave comments. Login now