Mercurial > hg-stable
changeset 44380:b42ce825308e
rebase: stop relying on having two parents to resume rebase
I'm about to make it so we don't have two parents when a rebase is
interrupted (unless we're just rebasing on a merge commit). The code
for detecting if we're resuming a rebase relied on having two parents,
so this patch rewrites that to instead set a boolean when we resume.
Note that `self.resume` in the new condition implies `not
self.inmemory` (rebase cannot be resumed in memory), so that's why
that part can be omitted.
Differential Revision: https://phab.mercurial-scm.org/D7826
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 10 Jan 2020 14:17:56 -0800 |
parents | 14d0e89520a2 |
children | 9c9cfecd4600 |
files | hgext/rebase.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Tue Jan 28 21:49:50 2020 -0800 +++ b/hgext/rebase.py Fri Jan 10 14:17:56 2020 -0800 @@ -178,6 +178,7 @@ # --continue or --abort)), the original repo should be used so # visibility-dependent revsets are correct. self.prepared = False + self.resume = False self._repo = repo self.ui = ui @@ -367,6 +368,7 @@ _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset) def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False): + self.resume = True try: self.restorestatus() self.collapsemsg = restorecollapsemsg(self.repo, isabort) @@ -606,8 +608,9 @@ self.skipped, self.obsoletenotrebased, ) - if not self.inmemory and len(repo[None].parents()) == 2: + if self.resume and self.wctx.p1().rev() == p1: repo.ui.debug(b'resuming interrupted rebase\n') + self.resume = False else: overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} with ui.configoverride(overrides, b'rebase'):