diff mercurial/treediscovery.py @ 46110:d90f439ff19f

debugdiscovery: display the number of roundtrip used This is a good metric of the complexity of a discovery process. Differential Revision: https://phab.mercurial-scm.org/D9565
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 11 Dec 2020 12:51:09 +0100
parents 89a2afe31e82
children d4ba4d51f85f
line wrap: on
line diff
--- a/mercurial/treediscovery.py	Fri Dec 11 13:39:56 2020 -0800
+++ b/mercurial/treediscovery.py	Fri Dec 11 12:51:09 2020 +0100
@@ -20,7 +20,7 @@
 )
 
 
-def findcommonincoming(repo, remote, heads=None, force=False):
+def findcommonincoming(repo, remote, heads=None, force=False, audit=None):
     """Return a tuple (common, fetch, heads) used to identify the common
     subset of nodes between repo and remote.
 
@@ -41,6 +41,9 @@
         with remote.commandexecutor() as e:
             heads = e.callcommand(b'heads', {}).result()
 
+    if audit is not None:
+        audit[b'total-roundtrips'] = 1
+
     if repo.changelog.tip() == nullid:
         base.add(nullid)
         if heads != [nullid]:
@@ -181,5 +184,7 @@
 
     progress.complete()
     repo.ui.debug(b"%d total queries\n" % reqcnt)
+    if audit is not None:
+        audit[b'total-roundtrips'] = reqcnt
 
     return base, list(fetch), heads