depthcache: issue a progress bar when loading the depth cache
The operation can be in the minute order of magnitude of some larger repository.
We better keep the user entertain when he wait.
--- a/hgext3rd/evolve/depthcache.py Wed Nov 22 15:05:15 2017 +0100
+++ b/hgext3rd/evolve/depthcache.py Thu Nov 23 16:53:29 2017 +0100
@@ -129,9 +129,18 @@
"""compute the rev of one revision, assert previous revision has an hot cache
"""
cl = repo.unfiltered().changelog
- for rev in data:
+ total = len(data)
+
+ def progress(pos, rev):
+ repo.ui.progress('updating depth cache',
+ pos, 'rev %s' % rev, unit='revision', total=total)
+ progress(0, '')
+ for idx, rev in enumerate(data, 1):
assert rev == len(self._data), (rev, len(self._data))
self._data.append(self._depth(cl, rev))
+ if not (idx % 10000): # progress as a too high performance impact
+ progress(idx, rev)
+ progress(None, '')
def _depth(self, changelog, rev):
cl = changelog