D10247: rebase: calculate obsolescense-related info earlier

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Mar 22 17:36:59 UTC 2021


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  My goal is to use `rewriteutil.precheck()` in the rebase code. Since
  rebase does its own handling of divergent commits (it skips them
  instead of erroring out), we need to have divergence-causing commits
  filtered out early. This patch helps prepare for that.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10247

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -369,6 +369,8 @@
         self.resume = True
         try:
             self.restorestatus()
+            # Calculate self.obsoletenotrebased
+            self._handleskippingobsolete()
             self.collapsemsg = restorecollapsemsg(self.repo, isabort)
         except error.RepoLookupError:
             if isabort:
@@ -435,6 +437,9 @@
 
         self.prepared = True
 
+        # Calculate self.obsoletenotrebased
+        self._handleskippingobsolete()
+
     def _assignworkingcopy(self):
         if self.inmemory:
             from mercurial.context import overlayworkingctx
@@ -468,9 +473,6 @@
                             _(b'cannot collapse multiple named branches')
                         )
 
-        # Calculate self.obsoletenotrebased
-        self._handleskippingobsolete()
-
         # Keep track of the active bookmarks in order to reset them later
         self.activebookmark = self.activebookmark or repo._activebookmark
         if self.activebookmark:



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list