Patchwork D3796: similar: use progress helper

login
register
mail settings
Submitter phabricator
Date June 18, 2018, 8:26 p.m.
Message ID <871e9f3afcca7c657b1843d4db967634@localhost.localdomain>
Download mbox | patch
Permalink /patch/32302/
State Not Applicable
Headers show

Comments

phabricator - June 18, 2018, 8:26 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG59c9d3cc810f: similar: use progress helper (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3796?vs=9190&id=9198

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

AFFECTED FILES
  mercurial/similar.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/similar.py b/mercurial/similar.py
--- a/mercurial/similar.py
+++ b/mercurial/similar.py
@@ -75,19 +75,19 @@ 
     (before, after, score) tuples of partial matches.
     '''
     copies = {}
-    for i, r in enumerate(removed):
-        repo.ui.progress(_('searching for similar files'), i,
-                         total=len(removed), unit=_('files'))
-
+    progress = repo.ui.makeprogress(_('searching for similar files'),
+                         unit=_('files'), total=len(removed))
+    for r in removed:
+        progress.increment()
         data = None
         for a in added:
             bestscore = copies.get(a, (None, threshold))[1]
             if data is None:
                 data = _ctxdata(r)
             myscore = _score(a, data)
             if myscore > bestscore:
                 copies[a] = (r, myscore)
-    repo.ui.progress(_('searching'), None)
+    progress.complete()
 
     for dest, v in copies.iteritems():
         source, bscore = v