--- a/mercurial/setdiscovery.py Fri Dec 11 13:39:56 2020 -0800
+++ b/mercurial/setdiscovery.py Fri Dec 11 12:51:09 2020 +0100
@@ -291,9 +291,14 @@
abortwhenunrelated=True,
ancestorsof=None,
samplegrowth=1.05,
+ audit=None,
):
"""Return a tuple (common, anyincoming, remoteheads) used to identify
missing nodes from or in remote.
+
+ The audit argument is an optional dictionnary that a caller can pass. it
+ will be updated with extra data about the discovery, this is useful for
+ debug.
"""
start = util.timer()
@@ -379,6 +384,9 @@
srvheadhashes, yesno = fheads.result(), fknown.result()
+ if audit is not None:
+ audit[b'total-roundtrips'] = 1
+
if cl.tip() == nullid:
if srvheadhashes != [nullid]:
return [nullid], True, srvheadhashes
@@ -473,6 +481,9 @@
missing = set(result) - set(knownsrvheads)
ui.log(b'discovery', msg, len(result), len(missing), roundtrips, elapsed)
+ if audit is not None:
+ audit[b'total-roundtrips'] = roundtrips
+
if not result and srvheadhashes != [nullid]:
if abortwhenunrelated:
raise error.Abort(_(b"repository is unrelated"))