D3796: similar: use progress helper
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon Jun 18 17:15:21 UTC 2018
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
A side-effect is that progress is now reported as 1 *before* we start
checking the first file. That seems to be how we do it in most places.
Also, the right topic is now closed.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3796
AFFECTED FILES
mercurial/similar.py
CHANGE DETAILS
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
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list