changeset 38350:9e70690a21ac

setdiscovery: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3770
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 06:23:29 -0700
parents e59eaf51cc0d
children de089e3eb328
files mercurial/setdiscovery.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Sat Jun 16 00:37:44 2018 -0700
+++ b/mercurial/setdiscovery.py	Sun Jun 17 06:23:29 2018 -0700
@@ -197,6 +197,7 @@
     missing = set()
 
     full = False
+    progress = ui.makeprogress(_('searching'), unit=_('queries'))
     while undecided:
 
         if sample:
@@ -226,7 +227,7 @@
             sample = samplefunc(dag, undecided, targetsize)
 
         roundtrips += 1
-        ui.progress(_('searching'), roundtrips, unit=_('queries'))
+        progress.update(roundtrips)
         ui.debug("query %i; still undecided: %i, sample size is: %i\n"
                  % (roundtrips, len(undecided), len(sample)))
         # indices between sample and externalized version must match
@@ -251,7 +252,7 @@
     # return any heads in that case, so discard that
     result.discard(nullrev)
     elapsed = util.timer() - start
-    ui.progress(_('searching'), None)
+    progress.update(None)
     ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed))
     msg = ('found %d common and %d unknown server heads,'
            ' %d roundtrips in %.4fs\n')