comparison tests/test-rebase-abort.t @ 42583:b9bc47211cf5

abort: added support for rebase This adds support of `rebase` to `hg abort` plan. An independent abort logic for `rebase` is created under `abortrebase()` function. For this a seperate `rebaseruntime` object is created under the function to handle an unfinished `rebasestate` and abort that using abort logic under `_prepareabortorcontinue`. Results of tests are shown. Differential Revision: https://phab.mercurial-scm.org/D6568
author Taapas Agrawal <taapas2897@gmail.com>
date Sun, 23 Jun 2019 23:11:35 +0530
parents 4edd427f34c1
children 35ebdbb38efb
comparison
equal deleted inserted replaced
42582:5171937ad0f9 42583:b9bc47211cf5
1 #testcases abortcommand abortflag
2
1 $ cat >> $HGRCPATH <<EOF 3 $ cat >> $HGRCPATH <<EOF
2 > [extensions] 4 > [extensions]
3 > rebase= 5 > rebase=
4 > 6 >
5 > [phases] 7 > [phases]
7 > 9 >
8 > [alias] 10 > [alias]
9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n" 11 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
10 > EOF 12 > EOF
11 13
14 #if abortflag
15 $ cat >> $HGRCPATH <<EOF
16 > [alias]
17 > abort = rebase --abort
18 > EOF
19 #endif
12 20
13 $ hg init a 21 $ hg init a
14 $ cd a 22 $ cd a
15 23
16 $ touch .hg/rebasestate 24 $ touch .hg/rebasestate
112 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information) 120 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
113 [255] 121 [255]
114 122
115 Abort (should clear out unsupported merge state): 123 Abort (should clear out unsupported merge state):
116 124
117 $ hg rebase --abort 125 #if abortcommand
126 when in dry-run mode
127 $ hg abort --dry-run
128 rebase in progress, will be aborted
129 #endif
130
131 $ hg abort
118 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg 132 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
119 rebase aborted 133 rebase aborted
120 $ hg debugmergestate 134 $ hg debugmergestate
121 no merge state found 135 no merge state found
122 136
152 abort: cannot continue inconsistent rebase 166 abort: cannot continue inconsistent rebase
153 (use "hg rebase --abort" to clear broken state) 167 (use "hg rebase --abort" to clear broken state)
154 [255] 168 [255]
155 $ hg summary | grep '^rebase: ' 169 $ hg summary | grep '^rebase: '
156 rebase: (use "hg rebase --abort" to clear broken state) 170 rebase: (use "hg rebase --abort" to clear broken state)
157 $ hg rebase --abort 171 $ hg abort
158 rebase aborted (no revision is removed, only broken state is cleared) 172 rebase aborted (no revision is removed, only broken state is cleared)
159 173
160 $ cd .. 174 $ cd ..
161 175
162 176
269 rebasing 3:6c0f977a22d8 "C" (foo tip) 283 rebasing 3:6c0f977a22d8 "C" (foo tip)
270 merging c 284 merging c
271 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') 285 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
272 unresolved conflicts (see hg resolve, then hg rebase --continue) 286 unresolved conflicts (see hg resolve, then hg rebase --continue)
273 [1] 287 [1]
274 $ hg rebase --abort 288 $ hg abort
275 rebase aborted 289 rebase aborted
276 $ hg log -G --template "{rev} {desc} {bookmarks}" 290 $ hg log -G --template "{rev} {desc} {bookmarks}"
277 @ 3 C foo 291 @ 3 C foo
278 | 292 |
279 | o 2 c master 293 | o 2 c master
322 (use 'hg rebase --continue' or 'hg rebase --abort') 336 (use 'hg rebase --continue' or 'hg rebase --abort')
323 [255] 337 [255]
324 338
325 $ cat a 339 $ cat a
326 new 340 new
327 $ hg rebase --abort 341 $ hg abort
328 rebase aborted 342 rebase aborted
329 $ cat a 343 $ cat a
330 new 344 new
331 345
332 $ cd .. 346 $ cd ..
403 $ hg graft 3 417 $ hg graft 3
404 abort: rebase in progress 418 abort: rebase in progress
405 (use 'hg rebase --continue' or 'hg rebase --abort') 419 (use 'hg rebase --continue' or 'hg rebase --abort')
406 [255] 420 [255]
407 421
408 $ hg rebase --abort 422 $ hg abort
409 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg 423 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
410 rebase aborted 424 rebase aborted
411 $ hg log -G --template "{rev} {desc} {bookmarks}" 425 $ hg log -G --template "{rev} {desc} {bookmarks}"
412 o 6 no-a 426 o 6 no-a
413 | 427 |
454 468
455 $ hg rebase -d 1 --tool 'internal:fail' 469 $ hg rebase -d 1 --tool 'internal:fail'
456 rebasing 2:e4ea5cdc9789 "conflicting 1" 470 rebasing 2:e4ea5cdc9789 "conflicting 1"
457 unresolved conflicts (see hg resolve, then hg rebase --continue) 471 unresolved conflicts (see hg resolve, then hg rebase --continue)
458 [1] 472 [1]
459 $ hg rebase --abort 473 $ hg abort
460 rebase aborted 474 rebase aborted
461 $ hg summary 475 $ hg summary
462 parent: 3:b16646383533 tip 476 parent: 3:b16646383533 tip
463 conflicting 2 477 conflicting 2
464 branch: default 478 branch: default
495 $ hg rebase -d 'public()' --tool :merge -q 509 $ hg rebase -d 'public()' --tool :merge -q
496 note: not rebasing 3:0682fd3dabf5 "disappear draft", its destination already has all its changes 510 note: not rebasing 3:0682fd3dabf5 "disappear draft", its destination already has all its changes
497 warning: conflicts while merging root! (edit, then use 'hg resolve --mark') 511 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
498 unresolved conflicts (see hg resolve, then hg rebase --continue) 512 unresolved conflicts (see hg resolve, then hg rebase --continue)
499 [1] 513 [1]
500 $ hg rebase --abort 514 $ hg abort
501 rebase aborted 515 rebase aborted
502 $ cd .. 516 $ cd ..
503 517