##// END OF EJS Templates
test-rebase: conditionalize output instead of tests...
Matt Harbison -
r33338:ad124b32 default
parent child Browse files
Show More
@@ -1,955 +1,949 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 > drawdag=$TESTDIR/drawdag.py
5 5 >
6 6 > [phases]
7 7 > publish=False
8 8 >
9 9 > [alias]
10 10 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
11 11 > EOF
12 12
13 13
14 14 $ hg init a
15 15 $ cd a
16 16 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
17 17 adding changesets
18 18 adding manifests
19 19 adding file changes
20 20 added 8 changesets with 7 changes to 7 files (+2 heads)
21 21 (run 'hg heads' to see heads, 'hg merge' to merge)
22 22 $ hg up tip
23 23 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 24 $ cd ..
25 25
26 26
27 27 Rebasing
28 28 D onto H - simple rebase:
29 29 (this also tests that editor is invoked if '--edit' is specified, and that we
30 30 can abort or warn for colliding untracked files)
31 31
32 32 $ hg clone -q -u . a a1
33 33 $ cd a1
34 34
35 35 $ hg tglog
36 36 @ 7: 'H'
37 37 |
38 38 | o 6: 'G'
39 39 |/|
40 40 o | 5: 'F'
41 41 | |
42 42 | o 4: 'E'
43 43 |/
44 44 | o 3: 'D'
45 45 | |
46 46 | o 2: 'C'
47 47 | |
48 48 | o 1: 'B'
49 49 |/
50 50 o 0: 'A'
51 51
52 52
53 53 $ hg status --rev "3^1" --rev 3
54 54 A D
55 55 $ echo collide > D
56 56 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
57 57 rebasing 3:32af7686d403 "D"
58 58 D: replacing untracked file
59 59 D
60 60
61 61
62 62 HG: Enter commit message. Lines beginning with 'HG:' are removed.
63 63 HG: Leave message empty to abort commit.
64 64 HG: --
65 65 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
66 66 HG: branch 'default'
67 67 HG: added D
68 68 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg (glob)
69 69 $ cat D.orig
70 70 collide
71 71 $ rm D.orig
72 72
73 73 $ hg tglog
74 74 o 7: 'D'
75 75 |
76 76 @ 6: 'H'
77 77 |
78 78 | o 5: 'G'
79 79 |/|
80 80 o | 4: 'F'
81 81 | |
82 82 | o 3: 'E'
83 83 |/
84 84 | o 2: 'C'
85 85 | |
86 86 | o 1: 'B'
87 87 |/
88 88 o 0: 'A'
89 89
90 90 $ cd ..
91 91
92 92
93 93 D onto F - intermediate point:
94 94 (this also tests that editor is not invoked if '--edit' is not specified, and
95 95 that we can ignore for colliding untracked files)
96 96
97 97 $ hg clone -q -u . a a2
98 98 $ cd a2
99 99 $ echo collide > D
100 100
101 101 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
102 102 rebasing 3:32af7686d403 "D"
103 103 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg (glob)
104 104 $ cat D.orig
105 105 collide
106 106 $ rm D.orig
107 107
108 108 $ hg tglog
109 109 o 7: 'D'
110 110 |
111 111 | @ 6: 'H'
112 112 |/
113 113 | o 5: 'G'
114 114 |/|
115 115 o | 4: 'F'
116 116 | |
117 117 | o 3: 'E'
118 118 |/
119 119 | o 2: 'C'
120 120 | |
121 121 | o 1: 'B'
122 122 |/
123 123 o 0: 'A'
124 124
125 125 $ cd ..
126 126
127 127
128 128 E onto H - skip of G:
129 129 (this also tests that we can overwrite untracked files and don't create backups
130 130 if they have the same contents)
131 131
132 132 $ hg clone -q -u . a a3
133 133 $ cd a3
134 134 $ hg cat -r 4 E | tee E
135 135 E
136 136
137 137 $ hg rebase -s 4 -d 7
138 138 rebasing 4:9520eea781bc "E"
139 139 rebasing 6:eea13746799a "G"
140 140 note: rebase of 6:eea13746799a created no changes to commit
141 141 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg (glob)
142 142 $ f E.orig
143 143 E.orig: file not found
144 144
145 145 $ hg tglog
146 146 o 6: 'E'
147 147 |
148 148 @ 5: 'H'
149 149 |
150 150 o 4: 'F'
151 151 |
152 152 | o 3: 'D'
153 153 | |
154 154 | o 2: 'C'
155 155 | |
156 156 | o 1: 'B'
157 157 |/
158 158 o 0: 'A'
159 159
160 160 $ cd ..
161 161
162 162
163 163 F onto E - rebase of a branching point (skip G):
164 164
165 165 $ hg clone -q -u . a a4
166 166 $ cd a4
167 167
168 168 $ hg rebase -s 5 -d 4
169 169 rebasing 5:24b6387c8c8c "F"
170 170 rebasing 6:eea13746799a "G"
171 171 note: rebase of 6:eea13746799a created no changes to commit
172 172 rebasing 7:02de42196ebe "H" (tip)
173 173 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg (glob)
174 174
175 175 $ hg tglog
176 176 @ 6: 'H'
177 177 |
178 178 o 5: 'F'
179 179 |
180 180 o 4: 'E'
181 181 |
182 182 | o 3: 'D'
183 183 | |
184 184 | o 2: 'C'
185 185 | |
186 186 | o 1: 'B'
187 187 |/
188 188 o 0: 'A'
189 189
190 190 $ cd ..
191 191
192 192
193 193 G onto H - merged revision having a parent in ancestors of target:
194 194
195 195 $ hg clone -q -u . a a5
196 196 $ cd a5
197 197
198 198 $ hg rebase -s 6 -d 7
199 199 rebasing 6:eea13746799a "G"
200 200 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg (glob)
201 201
202 202 $ hg tglog
203 203 o 7: 'G'
204 204 |\
205 205 | @ 6: 'H'
206 206 | |
207 207 | o 5: 'F'
208 208 | |
209 209 o | 4: 'E'
210 210 |/
211 211 | o 3: 'D'
212 212 | |
213 213 | o 2: 'C'
214 214 | |
215 215 | o 1: 'B'
216 216 |/
217 217 o 0: 'A'
218 218
219 219 $ cd ..
220 220
221 221
222 222 F onto B - G maintains E as parent:
223 223
224 224 $ hg clone -q -u . a a6
225 225 $ cd a6
226 226
227 227 $ hg rebase -s 5 -d 1
228 228 rebasing 5:24b6387c8c8c "F"
229 229 rebasing 6:eea13746799a "G"
230 230 rebasing 7:02de42196ebe "H" (tip)
231 231 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg (glob)
232 232
233 233 $ hg tglog
234 234 @ 7: 'H'
235 235 |
236 236 | o 6: 'G'
237 237 |/|
238 238 o | 5: 'F'
239 239 | |
240 240 | o 4: 'E'
241 241 | |
242 242 | | o 3: 'D'
243 243 | | |
244 244 +---o 2: 'C'
245 245 | |
246 246 o | 1: 'B'
247 247 |/
248 248 o 0: 'A'
249 249
250 250 $ cd ..
251 251
252 252
253 253 These will fail (using --source):
254 254
255 255 G onto F - rebase onto an ancestor:
256 256
257 257 $ hg clone -q -u . a a7
258 258 $ cd a7
259 259
260 260 $ hg rebase -s 6 -d 5
261 261 nothing to rebase
262 262 [1]
263 263
264 264 F onto G - rebase onto a descendant:
265 265
266 266 $ hg rebase -s 5 -d 6
267 267 abort: source is ancestor of destination
268 268 [255]
269 269
270 270 G onto B - merge revision with both parents not in ancestors of target:
271 271
272 272 $ hg rebase -s 6 -d 1
273 273 rebasing 6:eea13746799a "G"
274 274 abort: cannot use revision 6 as base, result would have 3 parents
275 275 [255]
276 276 $ hg rebase --abort
277 277 rebase aborted
278 278
279 279 These will abort gracefully (using --base):
280 280
281 281 G onto G - rebase onto same changeset:
282 282
283 283 $ hg rebase -b 6 -d 6
284 284 nothing to rebase - eea13746799a is both "base" and destination
285 285 [1]
286 286
287 287 G onto F - rebase onto an ancestor:
288 288
289 289 $ hg rebase -b 6 -d 5
290 290 nothing to rebase
291 291 [1]
292 292
293 293 F onto G - rebase onto a descendant:
294 294
295 295 $ hg rebase -b 5 -d 6
296 296 nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a
297 297 [1]
298 298
299 299 C onto A - rebase onto an ancestor:
300 300
301 301 $ hg rebase -d 0 -s 2
302 302 rebasing 2:5fddd98957c8 "C"
303 303 rebasing 3:32af7686d403 "D"
304 304 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg (glob)
305 305 $ hg tglog
306 306 o 7: 'D'
307 307 |
308 308 o 6: 'C'
309 309 |
310 310 | @ 5: 'H'
311 311 | |
312 312 | | o 4: 'G'
313 313 | |/|
314 314 | o | 3: 'F'
315 315 |/ /
316 316 | o 2: 'E'
317 317 |/
318 318 | o 1: 'B'
319 319 |/
320 320 o 0: 'A'
321 321
322 322
323 323 Check rebasing public changeset
324 324
325 325 $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6
326 326 $ hg rebase -d 0 -b 6
327 327 nothing to rebase
328 328 [1]
329 329 $ hg rebase -d 5 -b 6
330 330 abort: can't rebase public changeset e1c4361dd923
331 331 (see 'hg help phases' for details)
332 332 [255]
333 333 $ hg rebase -d 5 -r '1 + (6::)'
334 334 abort: can't rebase public changeset e1c4361dd923
335 335 (see 'hg help phases' for details)
336 336 [255]
337 337
338 338 $ hg rebase -d 5 -b 6 --keep
339 339 rebasing 6:e1c4361dd923 "C"
340 340 rebasing 7:c9659aac0000 "D" (tip)
341 341
342 342 Check rebasing mutable changeset
343 343 Source phase greater or equal to destination phase: new changeset get the phase of source:
344 344 $ hg id -n
345 345 5
346 346 $ hg rebase -s9 -d0
347 347 rebasing 9:2b23e52411f4 "D" (tip)
348 348 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg (glob)
349 349 $ hg id -n # check we updated back to parent
350 350 5
351 351 $ hg log --template "{phase}\n" -r 9
352 352 draft
353 353 $ hg rebase -s9 -d1
354 354 rebasing 9:2cb10d0cfc6c "D" (tip)
355 355 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg (glob)
356 356 $ hg log --template "{phase}\n" -r 9
357 357 draft
358 358 $ hg phase --force --secret 9
359 359 $ hg rebase -s9 -d0
360 360 rebasing 9:c5b12b67163a "D" (tip)
361 361 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg (glob)
362 362 $ hg log --template "{phase}\n" -r 9
363 363 secret
364 364 $ hg rebase -s9 -d1
365 365 rebasing 9:2a0524f868ac "D" (tip)
366 366 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg (glob)
367 367 $ hg log --template "{phase}\n" -r 9
368 368 secret
369 369 Source phase lower than destination phase: new changeset get the phase of destination:
370 370 $ hg rebase -s8 -d9
371 371 rebasing 8:6d4f22462821 "C"
372 372 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg (glob)
373 373 $ hg log --template "{phase}\n" -r 'rev(9)'
374 374 secret
375 375
376 376 $ cd ..
377 377
378 378 Test for revset
379 379
380 380 We need a bit different graph
381 381 All destination are B
382 382
383 383 $ hg init ah
384 384 $ cd ah
385 385 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
386 386 adding changesets
387 387 adding manifests
388 388 adding file changes
389 389 added 9 changesets with 9 changes to 9 files (+2 heads)
390 390 (run 'hg heads' to see heads, 'hg merge' to merge)
391 391 $ hg tglog
392 392 o 8: 'I'
393 393 |
394 394 o 7: 'H'
395 395 |
396 396 o 6: 'G'
397 397 |
398 398 | o 5: 'F'
399 399 | |
400 400 | o 4: 'E'
401 401 |/
402 402 o 3: 'D'
403 403 |
404 404 o 2: 'C'
405 405 |
406 406 | o 1: 'B'
407 407 |/
408 408 o 0: 'A'
409 409
410 410 $ cd ..
411 411
412 412
413 413 Simple case with keep:
414 414
415 415 Source on have two descendant heads but ask for one
416 416
417 417 $ hg clone -q -u . ah ah1
418 418 $ cd ah1
419 419 $ hg rebase -r '2::8' -d 1
420 420 abort: can't remove original changesets with unrebased descendants
421 421 (use --keep to keep original changesets)
422 422 [255]
423 423 $ hg rebase -r '2::8' -d 1 -k
424 424 rebasing 2:c9e50f6cdc55 "C"
425 425 rebasing 3:ffd453c31098 "D"
426 426 rebasing 6:3d8a618087a7 "G"
427 427 rebasing 7:72434a4e60b0 "H"
428 428 rebasing 8:479ddb54a924 "I" (tip)
429 429 $ hg tglog
430 430 o 13: 'I'
431 431 |
432 432 o 12: 'H'
433 433 |
434 434 o 11: 'G'
435 435 |
436 436 o 10: 'D'
437 437 |
438 438 o 9: 'C'
439 439 |
440 440 | o 8: 'I'
441 441 | |
442 442 | o 7: 'H'
443 443 | |
444 444 | o 6: 'G'
445 445 | |
446 446 | | o 5: 'F'
447 447 | | |
448 448 | | o 4: 'E'
449 449 | |/
450 450 | o 3: 'D'
451 451 | |
452 452 | o 2: 'C'
453 453 | |
454 454 o | 1: 'B'
455 455 |/
456 456 o 0: 'A'
457 457
458 458
459 459 $ cd ..
460 460
461 461 Base on have one descendant heads we ask for but common ancestor have two
462 462
463 463 $ hg clone -q -u . ah ah2
464 464 $ cd ah2
465 465 $ hg rebase -r '3::8' -d 1
466 466 abort: can't remove original changesets with unrebased descendants
467 467 (use --keep to keep original changesets)
468 468 [255]
469 469 $ hg rebase -r '3::8' -d 1 --keep
470 470 rebasing 3:ffd453c31098 "D"
471 471 rebasing 6:3d8a618087a7 "G"
472 472 rebasing 7:72434a4e60b0 "H"
473 473 rebasing 8:479ddb54a924 "I" (tip)
474 474 $ hg tglog
475 475 o 12: 'I'
476 476 |
477 477 o 11: 'H'
478 478 |
479 479 o 10: 'G'
480 480 |
481 481 o 9: 'D'
482 482 |
483 483 | o 8: 'I'
484 484 | |
485 485 | o 7: 'H'
486 486 | |
487 487 | o 6: 'G'
488 488 | |
489 489 | | o 5: 'F'
490 490 | | |
491 491 | | o 4: 'E'
492 492 | |/
493 493 | o 3: 'D'
494 494 | |
495 495 | o 2: 'C'
496 496 | |
497 497 o | 1: 'B'
498 498 |/
499 499 o 0: 'A'
500 500
501 501
502 502 $ cd ..
503 503
504 504 rebase subset
505 505
506 506 $ hg clone -q -u . ah ah3
507 507 $ cd ah3
508 508 $ hg rebase -r '3::7' -d 1
509 509 abort: can't remove original changesets with unrebased descendants
510 510 (use --keep to keep original changesets)
511 511 [255]
512 512 $ hg rebase -r '3::7' -d 1 --keep
513 513 rebasing 3:ffd453c31098 "D"
514 514 rebasing 6:3d8a618087a7 "G"
515 515 rebasing 7:72434a4e60b0 "H"
516 516 $ hg tglog
517 517 o 11: 'H'
518 518 |
519 519 o 10: 'G'
520 520 |
521 521 o 9: 'D'
522 522 |
523 523 | o 8: 'I'
524 524 | |
525 525 | o 7: 'H'
526 526 | |
527 527 | o 6: 'G'
528 528 | |
529 529 | | o 5: 'F'
530 530 | | |
531 531 | | o 4: 'E'
532 532 | |/
533 533 | o 3: 'D'
534 534 | |
535 535 | o 2: 'C'
536 536 | |
537 537 o | 1: 'B'
538 538 |/
539 539 o 0: 'A'
540 540
541 541
542 542 $ cd ..
543 543
544 544 rebase subset with multiple head
545 545
546 546 $ hg clone -q -u . ah ah4
547 547 $ cd ah4
548 548 $ hg rebase -r '3::(7+5)' -d 1
549 549 abort: can't remove original changesets with unrebased descendants
550 550 (use --keep to keep original changesets)
551 551 [255]
552 552 $ hg rebase -r '3::(7+5)' -d 1 --keep
553 553 rebasing 3:ffd453c31098 "D"
554 554 rebasing 4:c01897464e7f "E"
555 555 rebasing 5:41bfcc75ed73 "F"
556 556 rebasing 6:3d8a618087a7 "G"
557 557 rebasing 7:72434a4e60b0 "H"
558 558 $ hg tglog
559 559 o 13: 'H'
560 560 |
561 561 o 12: 'G'
562 562 |
563 563 | o 11: 'F'
564 564 | |
565 565 | o 10: 'E'
566 566 |/
567 567 o 9: 'D'
568 568 |
569 569 | o 8: 'I'
570 570 | |
571 571 | o 7: 'H'
572 572 | |
573 573 | o 6: 'G'
574 574 | |
575 575 | | o 5: 'F'
576 576 | | |
577 577 | | o 4: 'E'
578 578 | |/
579 579 | o 3: 'D'
580 580 | |
581 581 | o 2: 'C'
582 582 | |
583 583 o | 1: 'B'
584 584 |/
585 585 o 0: 'A'
586 586
587 587
588 588 $ cd ..
589 589
590 590 More advanced tests
591 591
592 592 rebase on ancestor with revset
593 593
594 594 $ hg clone -q -u . ah ah5
595 595 $ cd ah5
596 596 $ hg rebase -r '6::' -d 2
597 597 rebasing 6:3d8a618087a7 "G"
598 598 rebasing 7:72434a4e60b0 "H"
599 599 rebasing 8:479ddb54a924 "I" (tip)
600 600 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg (glob)
601 601 $ hg tglog
602 602 o 8: 'I'
603 603 |
604 604 o 7: 'H'
605 605 |
606 606 o 6: 'G'
607 607 |
608 608 | o 5: 'F'
609 609 | |
610 610 | o 4: 'E'
611 611 | |
612 612 | o 3: 'D'
613 613 |/
614 614 o 2: 'C'
615 615 |
616 616 | o 1: 'B'
617 617 |/
618 618 o 0: 'A'
619 619
620 620 $ cd ..
621 621
622 622
623 623 rebase with multiple root.
624 624 We rebase E and G on B
625 625 We would expect heads are I, F if it was supported
626 626
627 627 $ hg clone -q -u . ah ah6
628 628 $ cd ah6
629 629 $ hg rebase -r '(4+6)::' -d 1
630 630 rebasing 4:c01897464e7f "E"
631 631 rebasing 5:41bfcc75ed73 "F"
632 632 rebasing 6:3d8a618087a7 "G"
633 633 rebasing 7:72434a4e60b0 "H"
634 634 rebasing 8:479ddb54a924 "I" (tip)
635 635 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg (glob)
636 636 $ hg tglog
637 637 o 8: 'I'
638 638 |
639 639 o 7: 'H'
640 640 |
641 641 o 6: 'G'
642 642 |
643 643 | o 5: 'F'
644 644 | |
645 645 | o 4: 'E'
646 646 |/
647 647 | o 3: 'D'
648 648 | |
649 649 | o 2: 'C'
650 650 | |
651 651 o | 1: 'B'
652 652 |/
653 653 o 0: 'A'
654 654
655 655 $ cd ..
656 656
657 657 More complex rebase with multiple roots
658 658 each root have a different common ancestor with the destination and this is a detach
659 659
660 660 (setup)
661 661
662 662 $ hg clone -q -u . a a8
663 663 $ cd a8
664 664 $ echo I > I
665 665 $ hg add I
666 666 $ hg commit -m I
667 667 $ hg up 4
668 668 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
669 669 $ echo I > J
670 670 $ hg add J
671 671 $ hg commit -m J
672 672 created new head
673 673 $ echo I > K
674 674 $ hg add K
675 675 $ hg commit -m K
676 676 $ hg tglog
677 677 @ 10: 'K'
678 678 |
679 679 o 9: 'J'
680 680 |
681 681 | o 8: 'I'
682 682 | |
683 683 | o 7: 'H'
684 684 | |
685 685 +---o 6: 'G'
686 686 | |/
687 687 | o 5: 'F'
688 688 | |
689 689 o | 4: 'E'
690 690 |/
691 691 | o 3: 'D'
692 692 | |
693 693 | o 2: 'C'
694 694 | |
695 695 | o 1: 'B'
696 696 |/
697 697 o 0: 'A'
698 698
699 699 (actual test)
700 700
701 701 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
702 702 rebasing 8:e7ec4e813ba6 "I"
703 703 rebasing 10:23a4ace37988 "K" (tip)
704 704 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg (glob)
705 705 $ hg log --rev 'children(desc(G))'
706 706 changeset: 9:adb617877056
707 707 parent: 6:eea13746799a
708 708 user: test
709 709 date: Thu Jan 01 00:00:00 1970 +0000
710 710 summary: I
711 711
712 712 changeset: 10:882431a34a0e
713 713 tag: tip
714 714 parent: 6:eea13746799a
715 715 user: test
716 716 date: Thu Jan 01 00:00:00 1970 +0000
717 717 summary: K
718 718
719 719 $ hg tglog
720 720 @ 10: 'K'
721 721 |
722 722 | o 9: 'I'
723 723 |/
724 724 | o 8: 'J'
725 725 | |
726 726 | | o 7: 'H'
727 727 | | |
728 728 o---+ 6: 'G'
729 729 |/ /
730 730 | o 5: 'F'
731 731 | |
732 732 o | 4: 'E'
733 733 |/
734 734 | o 3: 'D'
735 735 | |
736 736 | o 2: 'C'
737 737 | |
738 738 | o 1: 'B'
739 739 |/
740 740 o 0: 'A'
741 741
742 742
743 743 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
744 744
745 745 $ cd ..
746 746 $ hg init cwd-vanish
747 747 $ cd cwd-vanish
748 748 $ touch initial-file
749 749 $ hg add initial-file
750 750 $ hg commit -m 'initial commit'
751 751 $ touch dest-file
752 752 $ hg add dest-file
753 753 $ hg commit -m 'dest commit'
754 754 $ hg up 0
755 755 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
756 756 $ touch other-file
757 757 $ hg add other-file
758 758 $ hg commit -m 'first source commit'
759 759 created new head
760 760 $ mkdir subdir
761 761 $ cd subdir
762 762 $ touch subfile
763 763 $ hg add subfile
764 764 $ hg commit -m 'second source with subdir'
765 #if rmcwd
765
766 766 $ hg rebase -b . -d 1 --traceback
767 767 rebasing 2:779a07b1b7a0 "first source commit"
768 current directory was removed
769 (consider changing to repo root: $TESTTMP/cwd-vanish)
768 current directory was removed (rmcwd !)
769 (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !)
770 770 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
771 771 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg (glob)
772 #else
773 $ hg rebase -b . -d 1 --traceback
774 rebasing 2:779a07b1b7a0 "first source commit"
775 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
776 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg (glob)
777 #endif
778 772
779 773 Get back to the root of cwd-vanish. Note that even though `cd ..`
780 774 works on most systems, it does not work on FreeBSD 10, so we use an
781 775 absolute path to get back to the repository.
782 776 $ cd $TESTTMP
783 777
784 778 Test that rebase is done in topo order (issue5370)
785 779
786 780 $ hg init order
787 781 $ cd order
788 782 $ touch a && hg add a && hg ci -m A
789 783 $ touch b && hg add b && hg ci -m B
790 784 $ touch c && hg add c && hg ci -m C
791 785 $ hg up 1
792 786 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
793 787 $ touch d && hg add d && hg ci -m D
794 788 created new head
795 789 $ hg up 2
796 790 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
797 791 $ touch e && hg add e && hg ci -m E
798 792 $ hg up 3
799 793 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
800 794 $ touch f && hg add f && hg ci -m F
801 795 $ hg up 0
802 796 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
803 797 $ touch g && hg add g && hg ci -m G
804 798 created new head
805 799
806 800 $ hg tglog
807 801 @ 6: 'G'
808 802 |
809 803 | o 5: 'F'
810 804 | |
811 805 | | o 4: 'E'
812 806 | | |
813 807 | o | 3: 'D'
814 808 | | |
815 809 | | o 2: 'C'
816 810 | |/
817 811 | o 1: 'B'
818 812 |/
819 813 o 0: 'A'
820 814
821 815
822 816 $ hg rebase -s 1 -d 6
823 817 rebasing 1:76035bbd54bd "B"
824 818 rebasing 2:d84f5cfaaf14 "C"
825 819 rebasing 4:82ae8dc7a9b7 "E"
826 820 rebasing 3:ab709c9f7171 "D"
827 821 rebasing 5:412b391de760 "F"
828 822 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg (glob)
829 823
830 824 $ hg tglog
831 825 o 6: 'F'
832 826 |
833 827 o 5: 'D'
834 828 |
835 829 | o 4: 'E'
836 830 | |
837 831 | o 3: 'C'
838 832 |/
839 833 o 2: 'B'
840 834 |
841 835 @ 1: 'G'
842 836 |
843 837 o 0: 'A'
844 838
845 839
846 840 Test experimental revset
847 841 ========================
848 842
849 843 $ cd ../cwd-vanish
850 844
851 845 Make the repo a bit more interesting
852 846
853 847 $ hg up 1
854 848 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
855 849 $ echo aaa > aaa
856 850 $ hg add aaa
857 851 $ hg commit -m aaa
858 852 created new head
859 853 $ hg log -G
860 854 @ changeset: 4:5f7bc9025ed2
861 855 | tag: tip
862 856 | parent: 1:58d79cc1cf43
863 857 | user: test
864 858 | date: Thu Jan 01 00:00:00 1970 +0000
865 859 | summary: aaa
866 860 |
867 861 | o changeset: 3:1910d5ff34ea
868 862 | | user: test
869 863 | | date: Thu Jan 01 00:00:00 1970 +0000
870 864 | | summary: second source with subdir
871 865 | |
872 866 | o changeset: 2:82901330b6ef
873 867 |/ user: test
874 868 | date: Thu Jan 01 00:00:00 1970 +0000
875 869 | summary: first source commit
876 870 |
877 871 o changeset: 1:58d79cc1cf43
878 872 | user: test
879 873 | date: Thu Jan 01 00:00:00 1970 +0000
880 874 | summary: dest commit
881 875 |
882 876 o changeset: 0:e94b687f7da3
883 877 user: test
884 878 date: Thu Jan 01 00:00:00 1970 +0000
885 879 summary: initial commit
886 880
887 881
888 882 Testing from lower head
889 883
890 884 $ hg up 3
891 885 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
892 886 $ hg log -r '_destrebase()'
893 887 changeset: 4:5f7bc9025ed2
894 888 tag: tip
895 889 parent: 1:58d79cc1cf43
896 890 user: test
897 891 date: Thu Jan 01 00:00:00 1970 +0000
898 892 summary: aaa
899 893
900 894
901 895 Testing from upper head
902 896
903 897 $ hg log -r '_destrebase(4)'
904 898 changeset: 3:1910d5ff34ea
905 899 user: test
906 900 date: Thu Jan 01 00:00:00 1970 +0000
907 901 summary: second source with subdir
908 902
909 903 $ hg up 4
910 904 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
911 905 $ hg log -r '_destrebase()'
912 906 changeset: 3:1910d5ff34ea
913 907 user: test
914 908 date: Thu Jan 01 00:00:00 1970 +0000
915 909 summary: second source with subdir
916 910
917 911 Testing rebase being called inside another transaction
918 912
919 913 $ cd $TESTTMP
920 914 $ hg init tr-state
921 915 $ cd tr-state
922 916 $ cat > $TESTTMP/wraprebase.py <<EOF
923 917 > from __future__ import absolute_import
924 918 > from mercurial import extensions
925 919 > def _rebase(orig, ui, repo, *args, **kwargs):
926 920 > with repo.wlock():
927 921 > with repo.lock():
928 922 > with repo.transaction('wrappedrebase'):
929 923 > return orig(ui, repo, *args, **kwargs)
930 924 > def wraprebase(loaded):
931 925 > assert loaded
932 926 > rebasemod = extensions.find('rebase')
933 927 > extensions.wrapcommand(rebasemod.cmdtable, 'rebase', _rebase)
934 928 > def extsetup(ui):
935 929 > extensions.afterloaded('rebase', wraprebase)
936 930 > EOF
937 931
938 932 $ cat >> .hg/hgrc <<EOF
939 933 > [extensions]
940 934 > wraprebase=$TESTTMP/wraprebase.py
941 935 > [experimental]
942 936 > evolution=all
943 937 > EOF
944 938
945 939 $ hg debugdrawdag <<'EOS'
946 940 > B C
947 941 > |/
948 942 > A
949 943 > EOS
950 944
951 945 $ hg rebase -s C -d B
952 946 rebasing 2:dc0947a82db8 "C" (C tip)
953 947
954 948 $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist'
955 949 [1]
General Comments 0
You need to be logged in to leave comments. Login now