Debian Codegraph @

tests/test-rebase-scenario-global.t

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