rebase: inline _performrebasesubset()
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 02 Mar 2018 15:38:20 -0800
changeset 36932 437f80436186
parent 36931 28f988093911
child 36933 61600b024a70
rebase: inline _performrebasesubset() Now that most of _performrebasesubset() has been moved into _rebasenode(), it's simple enough that we can inline it. Differential Revision: https://phab.mercurial-scm.org/D2810
hgext/rebase.py
--- a/hgext/rebase.py	Mon Mar 12 10:39:42 2018 -0700
+++ b/hgext/rebase.py	Fri Mar 02 15:38:20 2018 -0800
@@ -425,30 +425,27 @@
         total = len(cands)
         pos = 0
         for subset in sortsource(self.destmap):
-            pos = self._performrebasesubset(tr, subset, pos, total)
+            sortedrevs = self.repo.revs('sort(%ld, -topo)', subset)
+            allowdivergence = self.ui.configbool(
+                'experimental', 'evolution.allowdivergence')
+            if not allowdivergence:
+                sortedrevs -= self.repo.revs(
+                    'descendants(%ld) and not %ld',
+                    self.obsoletewithoutsuccessorindestination,
+                    self.obsoletewithoutsuccessorindestination,
+                )
+            posholder = [pos]
+            def progress(ctx):
+                posholder[0] += 1
+                self.repo.ui.progress(_("rebasing"), posholder[0],
+                                      ("%d:%s" % (ctx.rev(), ctx)),
+                                      _('changesets'), total)
+            for rev in sortedrevs:
+                self._rebasenode(tr, rev, allowdivergence, progress)
+            pos = posholder[0]
         ui.progress(_('rebasing'), None)
         ui.note(_('rebase merging completed\n'))
 
-    def _performrebasesubset(self, tr, subset, pos, total):
-        sortedrevs = self.repo.revs('sort(%ld, -topo)', subset)
-        allowdivergence = self.ui.configbool(
-            'experimental', 'evolution.allowdivergence')
-        if not allowdivergence:
-            sortedrevs -= self.repo.revs(
-                'descendants(%ld) and not %ld',
-                self.obsoletewithoutsuccessorindestination,
-                self.obsoletewithoutsuccessorindestination,
-            )
-        posholder = [pos]
-        def progress(ctx):
-            posholder[0] += 1
-            self.repo.ui.progress(_("rebasing"), posholder[0],
-                                  ("%d:%s" % (ctx.rev(), ctx)), _('changesets'),
-                                  total)
-        for rev in sortedrevs:
-            self._rebasenode(tr, rev, allowdivergence, progress)
-        return posholder[0]
-
     def _rebasenode(self, tr, rev, allowdivergence, progressfn):
         repo, ui, opts = self.repo, self.ui, self.opts
         dest = self.destmap[rev]