[PATCH 2 of 2] discovery: log discovery result in non-trivial cases

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jun 7 06:27:40 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1496828651 -3600
#      Wed Jun 07 10:44:11 2017 +0100
# Node ID 7ad4af1e46dae15170b2ad25750e857d3d5398d4
# Parent  264a9933cead269d3c28156b9b87890ef4cfb06a
# EXP-Topic discovery
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 7ad4af1e46da
discovery: log discovery result in non-trivial cases

We log the discovery summary, the number of roundtrips and the elapsed time.
This is useful to understand where slow push might come from when lloking at
the blackbox.

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -241,6 +241,9 @@ def findcommonheads(ui, local, remote,
     elapsed = util.timer() - start
     ui.progress(_('searching'), None)
     ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed))
+    msg = 'found %d common and %d missing heads, %d roundtrips in %.4fs\n'
+    ui.log('discovery', msg, len(result), len(srvheadhashes), roundtrips,
+           elapsed)
 
     if not result and srvheadhashes != [nullid]:
         if abortwhenunrelated:
diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -398,8 +398,13 @@ fixed in 86c35b7ae300:
   > unrandomsample = $TESTTMP/unrandomsample.py
   > EOF
 
-  $ hg -R r1 outgoing r2 -T'{rev} '
+  $ hg -R r1 outgoing r2 -T'{rev} ' --config extensions.blackbox=
   comparing with r2
   searching for changes
   101 102 103 104 105 106 107 108 109 110  (no-eol)
+  $ hg -R r1 --config extensions.blackbox= blackbox
+  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> outgoing r2 '-T{rev} ' (glob)
+  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> found 101 common and 101 missing heads, 2 roundtrips in *.????s (glob)
+  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing r2 '-T{rev} ' --config 'extensions.blackbox=' exited 0 after *.?? seconds (glob)
+  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> blackbox (glob)
   $ cd ..


More information about the Mercurial-devel mailing list