changeset 40035:7a347d362a45

exchangev2: add progress bar around manifest scanning This can take a long time on large repositories. Let's add a progress bar so we don't have long periods where it isn't obvious what is going on. Differential Revision: https://phab.mercurial-scm.org/D4859
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 03 Oct 2018 13:54:31 -0700
parents 393e44324037
children acf5dbe39478
files mercurial/exchangev2.py
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchangev2.py	Mon Oct 01 13:17:38 2018 -0700
+++ b/mercurial/exchangev2.py	Wed Oct 03 13:54:31 2018 -0700
@@ -320,19 +320,25 @@
     ml = repo.manifestlog
     fnodes = collections.defaultdict(dict)
 
-    for manifestnode in manifestnodes:
-        m = ml.get(b'', manifestnode)
+    progress = repo.ui.makeprogress(
+        _('scanning manifests'), total=len(manifestnodes))
+
+    with progress:
+        for manifestnode in manifestnodes:
+            m = ml.get(b'', manifestnode)
 
-        # TODO this will pull in unwanted nodes because it takes the storage
-        # delta into consideration. What we really want is something that takes
-        # the delta between the manifest's parents. And ideally we would
-        # ignore file nodes that are known locally. For now, ignore both
-        # these limitations. This will result in incremental fetches requesting
-        # data we already have. So this is far from ideal.
-        md = m.readfast()
+            # TODO this will pull in unwanted nodes because it takes the storage
+            # delta into consideration. What we really want is something that
+            # takes the delta between the manifest's parents. And ideally we
+            # would ignore file nodes that are known locally. For now, ignore
+            # both these limitations. This will result in incremental fetches
+            # requesting data we already have. So this is far from ideal.
+            md = m.readfast()
 
-        for path, fnode in md.items():
-            fnodes[path].setdefault(fnode, manifestnode)
+            for path, fnode in md.items():
+                fnodes[path].setdefault(fnode, manifestnode)
+
+            progress.increment()
 
     return fnodes