Mercurial > public > mercurial-scm > hg-stable
diff mercurial/setdiscovery.py @ 46111: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 | 397e39ad0174 |
line wrap: on
line diff
--- 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"))