changeset 38375:fce1c17493db

debugbuilddag: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3776
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 21:44:57 -0700
parents 800f5a2c869e
children 0d7ec620faef
files mercurial/debugcommands.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sun Jun 17 13:48:58 2018 -0700
+++ b/mercurial/debugcommands.py	Sun Jun 17 21:44:57 2018 -0700
@@ -183,6 +183,8 @@
     tags = []
 
     wlock = lock = tr = None
+    progress = ui.makeprogress(_('building'), unit=_('revisions'),
+                               total=total)
     try:
         wlock = repo.wlock()
         lock = repo.lock()
@@ -192,7 +194,7 @@
         atbranch = 'default'
         nodeids = []
         id = 0
-        ui.progress(_('building'), id, unit=_('revisions'), total=total)
+        progress.update(id)
         for type, data in dagparser.parsedag(text):
             if type == 'n':
                 ui.note(('node %s\n' % pycompat.bytestr(data)))
@@ -265,13 +267,13 @@
             elif type == 'a':
                 ui.note(('branch %s\n' % data))
                 atbranch = data
-            ui.progress(_('building'), id, unit=_('revisions'), total=total)
+            progress.update(id)
         tr.close()
 
         if tags:
             repo.vfs.write("localtags", "".join(tags))
     finally:
-        ui.progress(_('building'), None)
+        progress.complete()
         release(tr, lock, wlock)
 
 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):