discovery: log discovery result in non-trivial cases
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Jun 2017 10:44:11 +0100
changeset 37969 28240b75e880ee24b89789bb2d5f159354b52e2b
parent 37968 43bda143e3b2a75a79df102ef228620425ccfcc4
child 37970 ef8d245396121f0dd1687ba04a48a1da4ae13124
push id528
push usergszorc@mozilla.com
push dateThu, 15 Jun 2017 18:20:03 +0000
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.
mercurial/setdiscovery.py
tests/test-setdiscovery.t
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -236,16 +236,19 @@ def findcommonheads(ui, local, remote,
     # and all its ancestors
     result = dag.headsetofconnecteds(common.bases)
     # common.bases can include nullrev, but our contract requires us to not
     # return any heads in that case, so discard that
     result.discard(nullrev)
     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:
             raise error.Abort(_("repository is unrelated"))
         else:
             ui.warn(_("warning: repository is unrelated\n"))
         return ({nullid}, True, srvheadhashes,)
 
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -393,13 +393,18 @@ fixed in 86c35b7ae300:
   > random.sample = sample
   > EOF
 
   $ cat >> r1/.hg/hgrc << EOF
   > [extensions]
   > 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 ..