changeset 38377:a73eab7d6575

rebase: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3778
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 22:01:59 -0700
parents 0d7ec620faef
children e5d87c69bbcb
files hgext/rebase.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Jun 17 21:47:34 2018 -0700
+++ b/hgext/rebase.py	Sun Jun 17 22:01:59 2018 -0700
@@ -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):