mercurial/treediscovery.py
changeset 49017 f054a557aab8
parent 48875 6000f5b25c9b
child 49284 d44e3c45f0e4
--- a/mercurial/treediscovery.py	Sun Mar 13 16:10:53 2022 +0100
+++ b/mercurial/treediscovery.py	Mon Mar 14 05:59:20 2022 +0100
@@ -39,6 +39,7 @@
 
     if audit is not None:
         audit[b'total-roundtrips'] = 1
+        audit[b'total-queries'] = 0
 
     if repo.changelog.tip() == repo.nullid:
         base.add(repo.nullid)
@@ -69,6 +70,8 @@
     # head, root, first parent, second parent
     # (a branch always has two parents (or none) by definition)
     with remote.commandexecutor() as e:
+        if audit is not None:
+            audit[b'total-queries'] += len(unknown)
         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
 
     unknown = collections.deque(branches)
@@ -115,10 +118,13 @@
             )
             for p in pycompat.xrange(0, len(r), 10):
                 with remote.commandexecutor() as e:
+                    subset = r[p : p + 10]
+                    if audit is not None:
+                        audit[b'total-queries'] += len(subset)
                     branches = e.callcommand(
                         b'branches',
                         {
-                            b'nodes': r[p : p + 10],
+                            b'nodes': subset,
                         },
                     ).result()
 
@@ -135,6 +141,8 @@
         progress.increment()
 
         with remote.commandexecutor() as e:
+            if audit is not None:
+                audit[b'total-queries'] += len(search)
             between = e.callcommand(b'between', {b'pairs': search}).result()
 
         for n, l in zip(search, between):