Patchwork setdiscovery: improves logged message,

login
register
mail settings
Submitter Pierre-Yves David
Date June 10, 2017, 5:52 p.m.
Message ID <0682440ca1b93dc8c1d1.1497117133@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21316/
State Accepted
Headers show

Comments

Pierre-Yves David - June 10, 2017, 5:52 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1497116829 -3600
#      Sat Jun 10 18:47:09 2017 +0100
# Node ID 0682440ca1b93dc8c1d176e6dfc548a00225dc60
# Parent  776d077eb4ef815e08631fb1e7b33375adca3ef1
# EXP-Topic log.discovery
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0682440ca1b9
setdiscovery: improves logged message,

The 'srvheads' list contains all server heads including the common ones. We
adjust 'ui.log' message to provide more useful information about server heads
locally unknown. The performance impact of turning the list to set is
negligible (about 1e-4s) compared to the rest of the discovery cost, so I'm
taking the easy path.
Yuya Nishihara - June 11, 2017, 2:21 a.m.
On Sat, 10 Jun 2017 18:52:13 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1497116829 -3600
> #      Sat Jun 10 18:47:09 2017 +0100
> # Node ID 0682440ca1b93dc8c1d176e6dfc548a00225dc60
> # Parent  776d077eb4ef815e08631fb1e7b33375adca3ef1
> # EXP-Topic log.discovery
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0682440ca1b9
> setdiscovery: improves logged message,

Queued, thanks.

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -241,8 +241,10 @@  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,
+    msg = ('found %d common and %d unknown server heads,'
+           ' %d roundtrips in %.4fs\n')
+    missing = set(result) - set(srvheads)
+    ui.log('discovery', msg, len(result), len(missing), roundtrips,
            elapsed)
 
     if not result and srvheadhashes != [nullid]:
diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -404,7 +404,7 @@  fixed in 86c35b7ae300:
   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 (*)> found 101 common and 1 unknown server 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 ..