Patchwork D3778: rebase: use progress helper

login
register
mail settings
Submitter phabricator
Date June 18, 2018, 7:05 a.m.
Message ID <differential-rev-PHID-DREV-74wp6lpcyt3q5fjpt32h-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32236/
State Superseded
Headers show

Comments

phabricator - June 18, 2018, 7:05 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -433,13 +433,10 @@ 
             self.storestatus(tr)
 
         cands = [k for k, v in self.state.iteritems() if v == revtodo]
-        total = len(cands)
-        posholder = [0]
+        p = repo.ui.makeprogress(_("rebasing"), unit=_('changesets'),
+                                 total=len(cands))
         def progress(ctx):
-            posholder[0] += 1
-            self.repo.ui.progress(_("rebasing"), posholder[0],
-                                  ("%d:%s" % (ctx.rev(), ctx)),
-                                  _('changesets'), total)
+            p.increment(item=("%d:%s" % (ctx.rev(), ctx)))
         allowdivergence = self.ui.configbool(
             'experimental', 'evolution.allowdivergence')
         for subset in sortsource(self.destmap):
@@ -452,7 +449,7 @@ 
                 )
             for rev in sortedrevs:
                 self._rebasenode(tr, rev, allowdivergence, progress)
-        ui.progress(_('rebasing'), None)
+        p.complete()
         ui.note(_('rebase merging completed\n'))
 
     def _concludenode(self, rev, p1, p2, editor, commitmsg=None):