changeset 38400:2f5c622fcb73

treediscovery: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3801
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 23:54:58 -0700
parents 185588cb0c4b
children 5c0f06a8b497
files mercurial/treediscovery.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/treediscovery.py	Sun Jun 17 23:48:23 2018 -0700
+++ b/mercurial/treediscovery.py	Sun Jun 17 23:54:58 2018 -0700
@@ -61,6 +61,7 @@
 
     req = set(unknown)
     reqcnt = 0
+    progress = repo.ui.makeprogress(_('searching'), unit=_('queries'))
 
     # search through remote branches
     # a 'branch' here is a linear segment of history, with four parts:
@@ -107,7 +108,7 @@
 
         if r:
             reqcnt += 1
-            repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
+            progress.increment()
             repo.ui.debug("request %d: %s\n" %
                         (reqcnt, " ".join(map(short, r))))
             for p in xrange(0, len(r), 10):
@@ -125,7 +126,7 @@
     while search:
         newsearch = []
         reqcnt += 1
-        repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
+        progress.increment()
 
         with remote.commandexecutor() as e:
             between = e.callcommand('between', {'pairs': search}).result()
@@ -166,7 +167,7 @@
     repo.ui.debug("found new changesets starting at " +
                  " ".join([short(f) for f in fetch]) + "\n")
 
-    repo.ui.progress(_('searching'), None)
+    progress.complete()
     repo.ui.debug("%d total queries\n" % reqcnt)
 
     return base, list(fetch), heads