comparison tests/test-rebase-scenario-global.t @ 33332:3b7cb3d17137

rebase: use scmutil.cleanupnodes (issue5606) (BC) This patch migrates rebase to use scmutil.cleanupnodes API. It simplifies the code and makes rebase code reusable inside a transaction. This is a BC because the backup file is no longer strip-backup/*-backup.hg, but strip-backup/*-rebase.hg. The latter looks more reasonable since the directory name is "strip-backup" so there is no need to repeat "backup". I think the backup file name change is probably fine as a BC, since we have changed it before (aa4a1672583e) and didn't get complains. The end result of this series will be a much more consistent and unified backup names: command | old backup file suffix | new backup file suffix ------------------------------------------------------------------- amend | amend-backup.hg | amend.hg histedit | backup.hg (could be 2 files) | histedit.hg (single file) rebase | backup.hg | rebase.hg strip | backup.hg | backup.hg (note: backup files are under .hg/strip-backup) It also fixes issue5606 as a side effect because the new "delayedstrip" code path will carefully examine nodes (safestriproots) to make sure orphaned changesets won't get stripped by accident. Some warning messages are changed to the new "warning: orphaned descendants detected, not stripping HASHES", which provides more information about exactly what changesets are left behind. Another minor behavior change is when there is an obsoleted changeset with a successor in the destination branch, bookmarks pointing to that obsoleted changeset will not be moved. I have commented in test-rebase-obsolete.t explaining why that is more desirable.
author Jun Wu <quark@fb.com>
date Fri, 07 Jul 2017 18:51:46 -0700
parents 40ee74bfa111
children de324547c751
comparison
equal deleted inserted replaced
33331:4bae3c117b57 33332:3b7cb3d17137
63 HG: Leave message empty to abort commit. 63 HG: Leave message empty to abort commit.
64 HG: -- 64 HG: --
65 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com> 65 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
66 HG: branch 'default' 66 HG: branch 'default'
67 HG: added D 67 HG: added D
68 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob) 68 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg (glob)
69 $ cat D.orig 69 $ cat D.orig
70 collide 70 collide
71 $ rm D.orig 71 $ rm D.orig
72 72
73 $ hg tglog 73 $ hg tglog
98 $ cd a2 98 $ cd a2
99 $ echo collide > D 99 $ echo collide > D
100 100
101 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore 101 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
102 rebasing 3:32af7686d403 "D" 102 rebasing 3:32af7686d403 "D"
103 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob) 103 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg (glob)
104 $ cat D.orig 104 $ cat D.orig
105 collide 105 collide
106 $ rm D.orig 106 $ rm D.orig
107 107
108 $ hg tglog 108 $ hg tglog
136 136
137 $ hg rebase -s 4 -d 7 137 $ hg rebase -s 4 -d 7
138 rebasing 4:9520eea781bc "E" 138 rebasing 4:9520eea781bc "E"
139 rebasing 6:eea13746799a "G" 139 rebasing 6:eea13746799a "G"
140 note: rebase of 6:eea13746799a created no changes to commit 140 note: rebase of 6:eea13746799a created no changes to commit
141 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob) 141 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg (glob)
142 $ f E.orig 142 $ f E.orig
143 E.orig: file not found 143 E.orig: file not found
144 144
145 $ hg tglog 145 $ hg tglog
146 o 6: 'E' 146 o 6: 'E'
168 $ hg rebase -s 5 -d 4 168 $ hg rebase -s 5 -d 4
169 rebasing 5:24b6387c8c8c "F" 169 rebasing 5:24b6387c8c8c "F"
170 rebasing 6:eea13746799a "G" 170 rebasing 6:eea13746799a "G"
171 note: rebase of 6:eea13746799a created no changes to commit 171 note: rebase of 6:eea13746799a created no changes to commit
172 rebasing 7:02de42196ebe "H" (tip) 172 rebasing 7:02de42196ebe "H" (tip)
173 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-backup.hg (glob) 173 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg (glob)
174 174
175 $ hg tglog 175 $ hg tglog
176 @ 6: 'H' 176 @ 6: 'H'
177 | 177 |
178 o 5: 'F' 178 o 5: 'F'
195 $ hg clone -q -u . a a5 195 $ hg clone -q -u . a a5
196 $ cd a5 196 $ cd a5
197 197
198 $ hg rebase -s 6 -d 7 198 $ hg rebase -s 6 -d 7
199 rebasing 6:eea13746799a "G" 199 rebasing 6:eea13746799a "G"
200 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-backup.hg (glob) 200 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg (glob)
201 201
202 $ hg tglog 202 $ hg tglog
203 o 7: 'G' 203 o 7: 'G'
204 |\ 204 |\
205 | @ 6: 'H' 205 | @ 6: 'H'
226 226
227 $ hg rebase -s 5 -d 1 227 $ hg rebase -s 5 -d 1
228 rebasing 5:24b6387c8c8c "F" 228 rebasing 5:24b6387c8c8c "F"
229 rebasing 6:eea13746799a "G" 229 rebasing 6:eea13746799a "G"
230 rebasing 7:02de42196ebe "H" (tip) 230 rebasing 7:02de42196ebe "H" (tip)
231 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-backup.hg (glob) 231 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg (glob)
232 232
233 $ hg tglog 233 $ hg tglog
234 @ 7: 'H' 234 @ 7: 'H'
235 | 235 |
236 | o 6: 'G' 236 | o 6: 'G'
299 C onto A - rebase onto an ancestor: 299 C onto A - rebase onto an ancestor:
300 300
301 $ hg rebase -d 0 -s 2 301 $ hg rebase -d 0 -s 2
302 rebasing 2:5fddd98957c8 "C" 302 rebasing 2:5fddd98957c8 "C"
303 rebasing 3:32af7686d403 "D" 303 rebasing 3:32af7686d403 "D"
304 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-backup.hg (glob) 304 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg (glob)
305 $ hg tglog 305 $ hg tglog
306 o 7: 'D' 306 o 7: 'D'
307 | 307 |
308 o 6: 'C' 308 o 6: 'C'
309 | 309 |
343 Source phase greater or equal to destination phase: new changeset get the phase of source: 343 Source phase greater or equal to destination phase: new changeset get the phase of source:
344 $ hg id -n 344 $ hg id -n
345 5 345 5
346 $ hg rebase -s9 -d0 346 $ hg rebase -s9 -d0
347 rebasing 9:2b23e52411f4 "D" (tip) 347 rebasing 9:2b23e52411f4 "D" (tip)
348 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-backup.hg (glob) 348 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg (glob)
349 $ hg id -n # check we updated back to parent 349 $ hg id -n # check we updated back to parent
350 5 350 5
351 $ hg log --template "{phase}\n" -r 9 351 $ hg log --template "{phase}\n" -r 9
352 draft 352 draft
353 $ hg rebase -s9 -d1 353 $ hg rebase -s9 -d1
354 rebasing 9:2cb10d0cfc6c "D" (tip) 354 rebasing 9:2cb10d0cfc6c "D" (tip)
355 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-backup.hg (glob) 355 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg (glob)
356 $ hg log --template "{phase}\n" -r 9 356 $ hg log --template "{phase}\n" -r 9
357 draft 357 draft
358 $ hg phase --force --secret 9 358 $ hg phase --force --secret 9
359 $ hg rebase -s9 -d0 359 $ hg rebase -s9 -d0
360 rebasing 9:c5b12b67163a "D" (tip) 360 rebasing 9:c5b12b67163a "D" (tip)
361 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-backup.hg (glob) 361 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg (glob)
362 $ hg log --template "{phase}\n" -r 9 362 $ hg log --template "{phase}\n" -r 9
363 secret 363 secret
364 $ hg rebase -s9 -d1 364 $ hg rebase -s9 -d1
365 rebasing 9:2a0524f868ac "D" (tip) 365 rebasing 9:2a0524f868ac "D" (tip)
366 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-backup.hg (glob) 366 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg (glob)
367 $ hg log --template "{phase}\n" -r 9 367 $ hg log --template "{phase}\n" -r 9
368 secret 368 secret
369 Source phase lower than destination phase: new changeset get the phase of destination: 369 Source phase lower than destination phase: new changeset get the phase of destination:
370 $ hg rebase -s8 -d9 370 $ hg rebase -s8 -d9
371 rebasing 8:6d4f22462821 "C" 371 rebasing 8:6d4f22462821 "C"
372 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-backup.hg (glob) 372 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg (glob)
373 $ hg log --template "{phase}\n" -r 'rev(9)' 373 $ hg log --template "{phase}\n" -r 'rev(9)'
374 secret 374 secret
375 375
376 $ cd .. 376 $ cd ..
377 377
595 $ cd ah5 595 $ cd ah5
596 $ hg rebase -r '6::' -d 2 596 $ hg rebase -r '6::' -d 2
597 rebasing 6:3d8a618087a7 "G" 597 rebasing 6:3d8a618087a7 "G"
598 rebasing 7:72434a4e60b0 "H" 598 rebasing 7:72434a4e60b0 "H"
599 rebasing 8:479ddb54a924 "I" (tip) 599 rebasing 8:479ddb54a924 "I" (tip)
600 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-backup.hg (glob) 600 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg (glob)
601 $ hg tglog 601 $ hg tglog
602 o 8: 'I' 602 o 8: 'I'
603 | 603 |
604 o 7: 'H' 604 o 7: 'H'
605 | 605 |
630 rebasing 4:c01897464e7f "E" 630 rebasing 4:c01897464e7f "E"
631 rebasing 5:41bfcc75ed73 "F" 631 rebasing 5:41bfcc75ed73 "F"
632 rebasing 6:3d8a618087a7 "G" 632 rebasing 6:3d8a618087a7 "G"
633 rebasing 7:72434a4e60b0 "H" 633 rebasing 7:72434a4e60b0 "H"
634 rebasing 8:479ddb54a924 "I" (tip) 634 rebasing 8:479ddb54a924 "I" (tip)
635 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-backup.hg (glob) 635 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg (glob)
636 $ hg tglog 636 $ hg tglog
637 o 8: 'I' 637 o 8: 'I'
638 | 638 |
639 o 7: 'H' 639 o 7: 'H'
640 | 640 |
699 (actual test) 699 (actual test)
700 700
701 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)' 701 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
702 rebasing 8:e7ec4e813ba6 "I" 702 rebasing 8:e7ec4e813ba6 "I"
703 rebasing 10:23a4ace37988 "K" (tip) 703 rebasing 10:23a4ace37988 "K" (tip)
704 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-backup.hg (glob) 704 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg (glob)
705 $ hg log --rev 'children(desc(G))' 705 $ hg log --rev 'children(desc(G))'
706 changeset: 9:adb617877056 706 changeset: 9:adb617877056
707 parent: 6:eea13746799a 707 parent: 6:eea13746799a
708 user: test 708 user: test
709 date: Thu Jan 01 00:00:00 1970 +0000 709 date: Thu Jan 01 00:00:00 1970 +0000
766 $ hg rebase -b . -d 1 --traceback 766 $ hg rebase -b . -d 1 --traceback
767 rebasing 2:779a07b1b7a0 "first source commit" 767 rebasing 2:779a07b1b7a0 "first source commit"
768 current directory was removed 768 current directory was removed
769 (consider changing to repo root: $TESTTMP/cwd-vanish) 769 (consider changing to repo root: $TESTTMP/cwd-vanish)
770 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip) 770 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
771 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob) 771 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg (glob)
772 #else 772 #else
773 $ hg rebase -b . -d 1 --traceback 773 $ hg rebase -b . -d 1 --traceback
774 rebasing 2:779a07b1b7a0 "first source commit" 774 rebasing 2:779a07b1b7a0 "first source commit"
775 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip) 775 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
776 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob) 776 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob)
823 rebasing 1:76035bbd54bd "B" 823 rebasing 1:76035bbd54bd "B"
824 rebasing 2:d84f5cfaaf14 "C" 824 rebasing 2:d84f5cfaaf14 "C"
825 rebasing 4:82ae8dc7a9b7 "E" 825 rebasing 4:82ae8dc7a9b7 "E"
826 rebasing 3:ab709c9f7171 "D" 826 rebasing 3:ab709c9f7171 "D"
827 rebasing 5:412b391de760 "F" 827 rebasing 5:412b391de760 "F"
828 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-backup.hg (glob) 828 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg (glob)
829 829
830 $ hg tglog 830 $ hg tglog
831 o 6: 'F' 831 o 6: 'F'
832 | 832 |
833 o 5: 'D' 833 o 5: 'D'