Mercurial > hg
comparison hgext/rebase.py @ 44346: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 | 77bb38be00ea |
children | 9c9cfecd4600 |
comparison
equal
deleted
inserted
replaced
44345:14d0e89520a2 | 44346:b42ce825308e |
---|---|
176 # unfiltered repo to avoid visibility issues. | 176 # unfiltered repo to avoid visibility issues. |
177 # Before knowing rebasestate (i.e. when starting a new rebase (not | 177 # Before knowing rebasestate (i.e. when starting a new rebase (not |
178 # --continue or --abort)), the original repo should be used so | 178 # --continue or --abort)), the original repo should be used so |
179 # visibility-dependent revsets are correct. | 179 # visibility-dependent revsets are correct. |
180 self.prepared = False | 180 self.prepared = False |
181 self.resume = False | |
181 self._repo = repo | 182 self._repo = repo |
182 | 183 |
183 self.ui = ui | 184 self.ui = ui |
184 self.opts = opts | 185 self.opts = opts |
185 self.originalwd = None | 186 self.originalwd = None |
365 skippedset.update(self.obsoletewithoutsuccessorindestination) | 366 skippedset.update(self.obsoletewithoutsuccessorindestination) |
366 skippedset.update(obsoleteextinctsuccessors) | 367 skippedset.update(obsoleteextinctsuccessors) |
367 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset) | 368 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset) |
368 | 369 |
369 def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False): | 370 def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False): |
371 self.resume = True | |
370 try: | 372 try: |
371 self.restorestatus() | 373 self.restorestatus() |
372 self.collapsemsg = restorecollapsemsg(self.repo, isabort) | 374 self.collapsemsg = restorecollapsemsg(self.repo, isabort) |
373 except error.RepoLookupError: | 375 except error.RepoLookupError: |
374 if isabort: | 376 if isabort: |
604 self.destmap, | 606 self.destmap, |
605 self.state, | 607 self.state, |
606 self.skipped, | 608 self.skipped, |
607 self.obsoletenotrebased, | 609 self.obsoletenotrebased, |
608 ) | 610 ) |
609 if not self.inmemory and len(repo[None].parents()) == 2: | 611 if self.resume and self.wctx.p1().rev() == p1: |
610 repo.ui.debug(b'resuming interrupted rebase\n') | 612 repo.ui.debug(b'resuming interrupted rebase\n') |
613 self.resume = False | |
611 else: | 614 else: |
612 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} | 615 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} |
613 with ui.configoverride(overrides, b'rebase'): | 616 with ui.configoverride(overrides, b'rebase'): |
614 stats = rebasenode( | 617 stats = rebasenode( |
615 repo, | 618 repo, |