rebase: remove now-unnecessary arguments to _abort()
authorMartin von Zweigbergk <martinvonz@google.com>
Sun, 04 Mar 2018 08:50:12 -0800
changeset 53622 2041991f1ce2e02ef58e39a3f0585e6949f0c6b7
parent 53621 c8eb8d1fc6cfc8ca60d9b48904e5d26bc39ba00d
child 53623 67d20f62fd199d34f5c124398c1dd5797672e22a
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
rebase: remove now-unnecessary arguments to _abort() Since _abort() is now an instance method, we don't need to pass state that's available on "self". Differential Revision: https://phab.mercurial-scm.org/D5393
hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -342,19 +342,17 @@ class rebaseruntime(object):
                 return 0
             else:
                 msg = _('cannot continue inconsistent rebase')
                 hint = _('use "hg rebase --abort" to clear broken state')
                 raise error.Abort(msg, hint=hint)
 
         if isabort:
             backup = backup and self.backupf
-            return self._abort(self.repo, self.originalwd, self.destmap,
-                               self.state, activebookmark=self.activebookmark,
-                               backup=backup, suppwarns=suppwarns)
+            return self._abort(backup=backup, suppwarns=suppwarns)
 
     def _preparenewrebase(self, destmap):
         if not destmap:
             return _nothingtorebase()
 
         rebaseset = destmap.keys()
         allowunstable = obsolete.isenabled(self.repo, obsolete.allowunstableopt)
         if (not (self.keepf or allowunstable)
@@ -648,30 +646,27 @@ class rebaseruntime(object):
             skippedlen = len(self.skipped)
             ui.note(_("%d revisions have been skipped\n") % skippedlen)
         fm.end()
 
         if (self.activebookmark and self.activebookmark in repo._bookmarks and
             repo['.'].node() == repo._bookmarks[self.activebookmark]):
                 bookmarks.activate(repo, self.activebookmark)
 
-    def _abort(self, repo, originalwd, destmap, state, activebookmark=None,
-        backup=True, suppwarns=False):
-        '''Restore the repository to its original state.  Additional args:
+    def _abort(self, backup=True, suppwarns=False):
+        '''Restore the repository to its original state.'''
 
-        activebookmark: the name of the bookmark that should be active after the
-            restore'''
-
+        repo = self.repo
         try:
             # If the first commits in the rebased set get skipped during the
             # rebase, their values within the state mapping will be the dest
             # rev id. The rebased list must must not contain the dest rev
             # (issue4896)
-            rebased = [s for r, s in state.items()
-                       if s >= 0 and s != r and s != destmap[r]]
+            rebased = [s for r, s in self.state.items()
+                       if s >= 0 and s != r and s != self.destmap[r]]
             immutable = [d for d in rebased if not repo[d].mutable()]
             cleanup = True
             if immutable:
                 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
                              % ', '.join(bytes(repo[r]) for r in immutable),
                              hint=_("see 'hg help phases' for details"))
                 cleanup = False
 
@@ -685,31 +680,31 @@ class rebaseruntime(object):
 
             if cleanup:
                 shouldupdate = False
                 if rebased:
                     strippoints = [
                         c.node() for c in repo.set('roots(%ld)', rebased)]
 
                 updateifonnodes = set(rebased)
-                updateifonnodes.update(destmap.values())
-                updateifonnodes.add(originalwd)
+                updateifonnodes.update(self.destmap.values())
+                updateifonnodes.add(self.originalwd)
                 shouldupdate = repo['.'].rev() in updateifonnodes
 
                 # Update away from the rebase if necessary
-                if shouldupdate or needupdate(repo, state):
-                    mergemod.update(repo, originalwd, branchmerge=False,
+                if shouldupdate or needupdate(repo, self.state):
+                    mergemod.update(repo, self.originalwd, branchmerge=False,
                                     force=True)
 
                 # Strip from the first rebased revision
                 if rebased:
                     repair.strip(repo.ui, repo, strippoints, backup=backup)
 
-            if activebookmark and activebookmark in repo._bookmarks:
-                bookmarks.activate(repo, activebookmark)
+            if self.activebookmark and self.activebookmark in repo._bookmarks:
+                bookmarks.activate(repo, self.activebookmark)
 
         finally:
             clearstatus(repo)
             clearcollapsemsg(repo)
             if not suppwarns:
                 repo.ui.warn(_('rebase aborted\n'))
         return 0