Show More
@@ -112,6 +112,7 b' def rebase(ui, repo, **opts):' | |||
|
112 | 112 | Returns 0 on success, 1 if nothing to rebase. |
|
113 | 113 | """ |
|
114 | 114 | originalwd = target = None |
|
115 | activebookmark = None | |
|
115 | 116 | external = nullrev |
|
116 | 117 | state = {} |
|
117 | 118 | skipped = set() |
@@ -159,7 +160,7 b' def rebase(ui, repo, **opts):' | |||
|
159 | 160 | ui.warn(_('tool option will be ignored\n')) |
|
160 | 161 | |
|
161 | 162 | (originalwd, target, state, skipped, collapsef, keepf, |
|
162 |
|
|
|
163 | keepbranchesf, external, activebookmark) = restorestatus(repo) | |
|
163 | 164 | if abortf: |
|
164 | 165 | return abort(repo, originalwd, target, state) |
|
165 | 166 | else: |
@@ -245,7 +246,7 b' def rebase(ui, repo, **opts):' | |||
|
245 | 246 | |
|
246 | 247 | # Keep track of the current bookmarks in order to reset them later |
|
247 | 248 | currentbookmarks = repo._bookmarks.copy() |
|
248 | activebookmark = repo._bookmarkcurrent | |
|
249 | activebookmark = activebookmark or repo._bookmarkcurrent | |
|
249 | 250 | if activebookmark: |
|
250 | 251 | bookmarks.unsetcurrent(repo) |
|
251 | 252 | |
@@ -258,7 +259,7 b' def rebase(ui, repo, **opts):' | |||
|
258 | 259 | ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, repo[rev])), |
|
259 | 260 | _('changesets'), total) |
|
260 | 261 | storestatus(repo, originalwd, target, state, collapsef, keepf, |
|
261 |
|
|
|
262 | keepbranchesf, external, activebookmark) | |
|
262 | 263 | p1, p2 = defineparents(repo, rev, target, state, |
|
263 | 264 | targetancestors) |
|
264 | 265 | if len(repo.parents()) == 2: |
@@ -516,7 +517,7 b' def updatebookmarks(repo, targetnode, ns' | |||
|
516 | 517 | marks.write() |
|
517 | 518 | |
|
518 | 519 | def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches, |
|
519 | external): | |
|
520 | external, activebookmark): | |
|
520 | 521 | 'Store the current status to allow recovery' |
|
521 | 522 | f = repo.opener("rebasestate", "w") |
|
522 | 523 | f.write(repo[originalwd].hex() + '\n') |
@@ -525,6 +526,7 b' def storestatus(repo, originalwd, target' | |||
|
525 | 526 | f.write('%d\n' % int(collapse)) |
|
526 | 527 | f.write('%d\n' % int(keep)) |
|
527 | 528 | f.write('%d\n' % int(keepbranches)) |
|
529 | f.write('%s\n' % (activebookmark or '')) | |
|
528 | 530 | for d, v in state.iteritems(): |
|
529 | 531 | oldrev = repo[d].hex() |
|
530 | 532 | if v > nullmerge: |
@@ -545,6 +547,7 b' def restorestatus(repo):' | |||
|
545 | 547 | target = None |
|
546 | 548 | collapse = False |
|
547 | 549 | external = nullrev |
|
550 | activebookmark = None | |
|
548 | 551 | state = {} |
|
549 | 552 | f = repo.opener("rebasestate") |
|
550 | 553 | for i, l in enumerate(f.read().splitlines()): |
@@ -560,6 +563,10 b' def restorestatus(repo):' | |||
|
560 | 563 | keep = bool(int(l)) |
|
561 | 564 | elif i == 5: |
|
562 | 565 | keepbranches = bool(int(l)) |
|
566 | elif i == 6 and not (len(l) == 81 and ':' in l): | |
|
567 | # line 6 is a recent addition, so for backwards compatibility | |
|
568 | # check that the line doesn't look like the oldrev:newrev lines | |
|
569 | activebookmark = l | |
|
563 | 570 | else: |
|
564 | 571 | oldrev, newrev = l.split(':') |
|
565 | 572 | if newrev in (str(nullmerge), str(revignored)): |
@@ -577,7 +584,7 b' def restorestatus(repo):' | |||
|
577 | 584 | repo.ui.debug('computed skipped revs: %s\n' % skipped) |
|
578 | 585 | repo.ui.debug('rebase status resumed\n') |
|
579 | 586 | return (originalwd, target, state, skipped, |
|
580 | collapse, keep, keepbranches, external) | |
|
587 | collapse, keep, keepbranches, external, activebookmark) | |
|
581 | 588 | except IOError, err: |
|
582 | 589 | if err.errno != errno.ENOENT: |
|
583 | 590 | raise |
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | > publish=False |
|
8 | 8 | > |
|
9 | 9 | > [alias] |
|
10 | > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n" | |
|
10 | > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n" | |
|
11 | 11 | > EOF |
|
12 | 12 | |
|
13 | 13 | $ hg init a |
@@ -36,11 +36,12 b'' | |||
|
36 | 36 | $ echo l3 >> extra2 |
|
37 | 37 | $ hg add extra2 |
|
38 | 38 | $ hg ci -m L3 |
|
39 | $ hg bookmark mybook | |
|
39 | 40 | |
|
40 | 41 | $ hg phase --force --secret 4 |
|
41 | 42 | |
|
42 | 43 | $ hg tglog |
|
43 | @ 5:secret 'L3' | |
|
44 | @ 5:secret 'L3' mybook | |
|
44 | 45 | | |
|
45 | 46 | o 4:secret 'L2' |
|
46 | 47 | | |
@@ -81,7 +82,7 b' Conclude rebase:' | |||
|
81 | 82 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) |
|
82 | 83 | |
|
83 | 84 | $ hg tglog |
|
84 | @ 5:secret 'L3' | |
|
85 | @ 5:secret 'L3' mybook | |
|
85 | 86 | | |
|
86 | 87 | o 4:secret 'L2' |
|
87 | 88 | | |
@@ -118,4 +119,8 b' Check correctness:' | |||
|
118 | 119 | $ hg cat -r 5 common |
|
119 | 120 | resolved merge |
|
120 | 121 | |
|
122 | Bookmark stays active after --continue | |
|
123 | $ hg bookmarks | |
|
124 | * mybook 5:d67b21408fc0 | |
|
125 | ||
|
121 | 126 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now