Patchwork D3770: setdiscovery: use progress helper

login
register
mail settings
Submitter phabricator
Date June 17, 2018, 4:42 p.m.
Message ID <differential-rev-PHID-DREV-rkp667tqmpsxbrtte4uo-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32220/
State Superseded
Headers show

Comments

phabricator - June 17, 2018, 4:42 p.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/D3770

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - June 17, 2018, 6:49 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> setdiscovery.py:230
>          roundtrips += 1
> -        ui.progress(_('searching'), roundtrips, unit=_('queries'))
> +        progress.increment()
>          ui.debug("query %i; still undecided: %i, sample size is: %i\n"

Sorry, this should be progress.update(roundtrips) since progress starts at 1 (not 0). Feel free to fix in place, or let me know and I'll send a fixup

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -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.increment()
         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')