##// END OF EJS Templates
similar: use progress helper...
Martin von Zweigbergk -
r38367:cd196be2 default
parent child Browse files
Show More
@@ -18,14 +18,14 b' def _findexactmatches(repo, added, remov'
18 Takes a list of new filectxs and a list of removed filectxs, and yields
18 Takes a list of new filectxs and a list of removed filectxs, and yields
19 (before, after) tuples of exact matches.
19 (before, after) tuples of exact matches.
20 '''
20 '''
21 numfiles = len(added) + len(removed)
22
23 # Build table of removed files: {hash(fctx.data()): [fctx, ...]}.
21 # Build table of removed files: {hash(fctx.data()): [fctx, ...]}.
24 # We use hash() to discard fctx.data() from memory.
22 # We use hash() to discard fctx.data() from memory.
25 hashes = {}
23 hashes = {}
26 for i, fctx in enumerate(removed):
24 progress = repo.ui.makeprogress(_('searching for exact renames'),
27 repo.ui.progress(_('searching for exact renames'), i, total=numfiles,
25 total=(len(added) + len(removed)),
28 unit=_('files'))
26 unit=_('files'))
27 for fctx in removed:
28 progress.increment()
29 h = hash(fctx.data())
29 h = hash(fctx.data())
30 if h not in hashes:
30 if h not in hashes:
31 hashes[h] = [fctx]
31 hashes[h] = [fctx]
@@ -33,9 +33,8 b' def _findexactmatches(repo, added, remov'
33 hashes[h].append(fctx)
33 hashes[h].append(fctx)
34
34
35 # For each added file, see if it corresponds to a removed file.
35 # For each added file, see if it corresponds to a removed file.
36 for i, fctx in enumerate(added):
36 for fctx in added:
37 repo.ui.progress(_('searching for exact renames'), i + len(removed),
37 progress.increment()
38 total=numfiles, unit=_('files'))
39 adata = fctx.data()
38 adata = fctx.data()
40 h = hash(adata)
39 h = hash(adata)
41 for rfctx in hashes.get(h, []):
40 for rfctx in hashes.get(h, []):
@@ -45,7 +44,7 b' def _findexactmatches(repo, added, remov'
45 break
44 break
46
45
47 # Done
46 # Done
48 repo.ui.progress(_('searching for exact renames'), None)
47 progress.update(None)
49
48
50 def _ctxdata(fctx):
49 def _ctxdata(fctx):
51 # lazily load text
50 # lazily load text
@@ -379,7 +379,7 b' Test relative path printing + subrepos'
379 $ touch bar/abc
379 $ touch bar/abc
380 $ hg addremove -S ..
380 $ hg addremove -S ..
381 \r (no-eol) (esc)
381 \r (no-eol) (esc)
382 searching for exact renames [ ] 0/1\r (no-eol) (esc)
382 searching for exact renames [========================>] 1/1\r (no-eol) (esc)
383 \r (no-eol) (esc)
383 \r (no-eol) (esc)
384 adding ../sub1/sub2/folder/test.txt
384 adding ../sub1/sub2/folder/test.txt
385 removing ../sub1/sub2/test.txt
385 removing ../sub1/sub2/test.txt
General Comments 0
You need to be logged in to leave comments. Login now