[PATCH 3 of 6 "V2] debugdiscovery: display more statistic about the common set
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Mar 27 07:23:11 EDT 2019
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1553617522 -3600
# Tue Mar 26 17:25:22 2019 +0100
# Node ID d593a516f74bdf4dd90e46bd16a6611356503036
# Parent faecfbf1a16ef274e365de1ea0cd16fb53020ad3
# EXP-Topic debug-discovery
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d593a516f74b
debugdiscovery: display more statistic about the common set
We display a lot more information now. Especially, we display the overlap
between the common heads and the local/remote heads. There are various
optimization geared toward heads, as a result, the less common the heads the
more complex the discovery. Having this information easily accessible help when
working on discovery.
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -817,9 +817,38 @@ def debugdiscovery(ui, repo, remoteurl="
localrevs = opts['rev']
common, hds = doit(localrevs, remoterevs)
+ # compute all statistics
common = set(common)
rheads = set(hds)
lheads = set(repo.heads())
+
+ data = {}
+ data['nb-common'] = len(common)
+ data['nb-common-local'] = len(common & lheads)
+ data['nb-common-remote'] = len(common & rheads)
+ data['nb-local'] = len(lheads)
+ data['nb-local-missing'] = data['nb-local'] - data['nb-common-local']
+ data['nb-remote'] = len(rheads)
+ data['nb-remote-unknown'] = data['nb-remote'] - data['nb-common-remote']
+ data['nb-revs'] = len(repo.revs('all()'))
+ data['nb-revs-common'] = len(repo.revs('::%ln', common))
+ data['nb-revs-missing'] = data['nb-revs'] - data['nb-revs-common']
+
+ # display discovery summary
+ ui.write(("heads summary:\n"))
+ ui.write((" total common heads: %(nb-common)9d\n") % data)
+ ui.write((" also local heads: %(nb-common-local)9d\n") % data)
+ ui.write((" also remote heads: %(nb-common-remote)9d\n") % data)
+ ui.write((" local heads: %(nb-local)9d\n") % data)
+ ui.write((" common: %(nb-common-local)9d\n") % data)
+ ui.write((" missing: %(nb-local-missing)9d\n") % data)
+ ui.write((" remote heads: %(nb-remote)9d\n") % data)
+ ui.write((" common: %(nb-common-remote)9d\n") % data)
+ ui.write((" unknown: %(nb-remote-unknown)9d\n") % data)
+ ui.write(("local changesets: %(nb-revs)9d\n") % data)
+ ui.write((" common: %(nb-revs-common)9d\n") % data)
+ ui.write((" missing: %(nb-revs-missing)9d\n") % data)
+
ui.write(("common heads: %s\n") %
" ".join(sorted(short(n) for n in common)))
if lheads <= common:
diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -43,6 +43,19 @@ Small superset:
comparing with b
searching for changes
unpruned common: 01241442b3c2 66f7d451a68b b5714e113bc0
+ heads summary:
+ total common heads: 2
+ also local heads: 2
+ also remote heads: 1
+ local heads: 2
+ common: 2
+ missing: 0
+ remote heads: 3
+ common: 1
+ unknown: 2
+ local changesets: 7
+ common: 7
+ missing: 0
common heads: 01241442b3c2 b5714e113bc0
local is subset
@@ -51,6 +64,19 @@ Small superset:
query 1; heads
searching for changes
all local heads known remotely
+ heads summary:
+ total common heads: 2
+ also local heads: 2
+ also remote heads: 1
+ local heads: 2
+ common: 2
+ missing: 0
+ remote heads: 3
+ common: 1
+ unknown: 2
+ local changesets: 7
+ common: 7
+ missing: 0
common heads: 01241442b3c2 b5714e113bc0
local is subset
@@ -59,12 +85,38 @@ Small superset:
query 1; heads
searching for changes
all local heads known remotely
+ heads summary:
+ total common heads: 1
+ also local heads: 1
+ also remote heads: 0
+ local heads: 2
+ common: 1
+ missing: 1
+ remote heads: 3
+ common: 0
+ unknown: 3
+ local changesets: 7
+ common: 6
+ missing: 1
common heads: b5714e113bc0
% -- b -> a tree
comparing with a
searching for changes
unpruned common: 01241442b3c2 b5714e113bc0
+ heads summary:
+ total common heads: 2
+ also local heads: 1
+ also remote heads: 2
+ local heads: 3
+ common: 1
+ missing: 2
+ remote heads: 2
+ common: 2
+ unknown: 0
+ local changesets: 15
+ common: 7
+ missing: 8
common heads: 01241442b3c2 b5714e113bc0
remote is subset
@@ -73,6 +125,19 @@ Small superset:
query 1; heads
searching for changes
all remote heads known locally
+ heads summary:
+ total common heads: 2
+ also local heads: 1
+ also remote heads: 2
+ local heads: 3
+ common: 1
+ missing: 2
+ remote heads: 2
+ common: 2
+ unknown: 0
+ local changesets: 15
+ common: 7
+ missing: 8
common heads: 01241442b3c2 b5714e113bc0
remote is subset
@@ -81,6 +146,19 @@ Small superset:
query 1; heads
searching for changes
all remote heads known locally
+ heads summary:
+ total common heads: 2
+ also local heads: 1
+ also remote heads: 2
+ local heads: 3
+ common: 1
+ missing: 2
+ remote heads: 2
+ common: 2
+ unknown: 0
+ local changesets: 15
+ common: 7
+ missing: 8
common heads: 01241442b3c2 b5714e113bc0
remote is subset
@@ -95,6 +173,19 @@ Many new:
comparing with b
searching for changes
unpruned common: bebd167eb94d
+ heads summary:
+ total common heads: 1
+ also local heads: 1
+ also remote heads: 0
+ local heads: 2
+ common: 1
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 35
+ common: 5
+ missing: 30
common heads: bebd167eb94d
% -- a -> b set
@@ -105,6 +196,19 @@ Many new:
searching: 2 queries
query 2; still undecided: 29, sample size is: 29
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 1
+ also remote heads: 0
+ local heads: 2
+ common: 1
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 35
+ common: 5
+ missing: 30
common heads: bebd167eb94d
% -- a -> b set (tip only)
@@ -115,12 +219,38 @@ Many new:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 2
+ common: 0
+ missing: 2
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 35
+ common: 2
+ missing: 33
common heads: 66f7d451a68b
% -- b -> a tree
comparing with a
searching for changes
unpruned common: 66f7d451a68b bebd167eb94d
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 1
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 2
+ common: 1
+ unknown: 1
+ local changesets: 8
+ common: 5
+ missing: 3
common heads: bebd167eb94d
% -- b -> a set
@@ -131,6 +261,19 @@ Many new:
searching: 2 queries
query 2; still undecided: 2, sample size is: 2
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 1
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 2
+ common: 1
+ unknown: 1
+ local changesets: 8
+ common: 5
+ missing: 3
common heads: bebd167eb94d
% -- b -> a set (tip only)
@@ -141,6 +284,19 @@ Many new:
searching: 2 queries
query 2; still undecided: 2, sample size is: 2
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 1
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 2
+ common: 1
+ unknown: 1
+ local changesets: 8
+ common: 5
+ missing: 3
common heads: bebd167eb94d
Both sides many new with stub:
@@ -153,6 +309,19 @@ Both sides many new with stub:
comparing with b
searching for changes
unpruned common: 2dc09a01254d
+ heads summary:
+ total common heads: 1
+ also local heads: 1
+ also remote heads: 0
+ local heads: 2
+ common: 1
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 34
+ common: 4
+ missing: 30
common heads: 2dc09a01254d
% -- a -> b set
@@ -163,6 +332,19 @@ Both sides many new with stub:
searching: 2 queries
query 2; still undecided: 29, sample size is: 29
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 1
+ also remote heads: 0
+ local heads: 2
+ common: 1
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 34
+ common: 4
+ missing: 30
common heads: 2dc09a01254d
% -- a -> b set (tip only)
@@ -173,12 +355,38 @@ Both sides many new with stub:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 2
+ common: 0
+ missing: 2
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 34
+ common: 2
+ missing: 32
common heads: 66f7d451a68b
% -- b -> a tree
comparing with a
searching for changes
unpruned common: 2dc09a01254d 66f7d451a68b
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 1
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 2
+ common: 1
+ unknown: 1
+ local changesets: 34
+ common: 4
+ missing: 30
common heads: 2dc09a01254d
% -- b -> a set
@@ -189,6 +397,19 @@ Both sides many new with stub:
searching: 2 queries
query 2; still undecided: 29, sample size is: 29
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 1
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 2
+ common: 1
+ unknown: 1
+ local changesets: 34
+ common: 4
+ missing: 30
common heads: 2dc09a01254d
% -- b -> a set (tip only)
@@ -199,6 +420,19 @@ Both sides many new with stub:
searching: 2 queries
query 2; still undecided: 29, sample size is: 29
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 1
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 2
+ common: 1
+ unknown: 1
+ local changesets: 34
+ common: 4
+ missing: 30
common heads: 2dc09a01254d
@@ -212,6 +446,19 @@ Both many new:
comparing with b
searching for changes
unpruned common: 66f7d451a68b
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- a -> b set
@@ -222,6 +469,19 @@ Both many new:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- a -> b set (tip only)
@@ -232,12 +492,38 @@ Both many new:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- b -> a tree
comparing with a
searching for changes
unpruned common: 66f7d451a68b
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- b -> a set
@@ -248,6 +534,19 @@ Both many new:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- b -> a set (tip only)
@@ -258,6 +557,19 @@ Both many new:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
@@ -271,6 +583,19 @@ Both many new skewed:
comparing with b
searching for changes
unpruned common: 66f7d451a68b
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 52
+ common: 2
+ missing: 50
common heads: 66f7d451a68b
% -- a -> b set
@@ -281,6 +606,19 @@ Both many new skewed:
searching: 2 queries
query 2; still undecided: 51, sample size is: 51
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 52
+ common: 2
+ missing: 50
common heads: 66f7d451a68b
% -- a -> b set (tip only)
@@ -291,12 +629,38 @@ Both many new skewed:
searching: 2 queries
query 2; still undecided: 51, sample size is: 51
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 52
+ common: 2
+ missing: 50
common heads: 66f7d451a68b
% -- b -> a tree
comparing with a
searching for changes
unpruned common: 66f7d451a68b
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- b -> a set
@@ -307,6 +671,19 @@ Both many new skewed:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
% -- b -> a set (tip only)
@@ -317,6 +694,19 @@ Both many new skewed:
searching: 2 queries
query 2; still undecided: 31, sample size is: 31
2 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 32
+ common: 2
+ missing: 30
common heads: 66f7d451a68b
@@ -330,6 +720,19 @@ Both many new on top of long history:
comparing with b
searching for changes
unpruned common: 7ead0cba2838
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1050
+ common: 1000
+ missing: 50
common heads: 7ead0cba2838
% -- a -> b set
@@ -343,6 +746,19 @@ Both many new on top of long history:
searching: 3 queries
query 3; still undecided: 31, sample size is: 31
3 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1050
+ common: 1000
+ missing: 50
common heads: 7ead0cba2838
% -- a -> b set (tip only)
@@ -356,12 +772,38 @@ Both many new on top of long history:
searching: 3 queries
query 3; still undecided: 31, sample size is: 31
3 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1050
+ common: 1000
+ missing: 50
common heads: 7ead0cba2838
% -- b -> a tree
comparing with a
searching for changes
unpruned common: 7ead0cba2838
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1030
+ common: 1000
+ missing: 30
common heads: 7ead0cba2838
% -- b -> a set
@@ -375,6 +817,19 @@ Both many new on top of long history:
searching: 3 queries
query 3; still undecided: 15, sample size is: 15
3 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1030
+ common: 1000
+ missing: 30
common heads: 7ead0cba2838
% -- b -> a set (tip only)
@@ -388,6 +843,19 @@ Both many new on top of long history:
searching: 3 queries
query 3; still undecided: 15, sample size is: 15
3 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 1
+ common: 0
+ missing: 1
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1030
+ common: 1000
+ missing: 30
common heads: 7ead0cba2838
@@ -453,6 +921,19 @@ One with >200 heads, which used to use u
searching: 6 queries
query 6; still undecided: \d+, sample size is: \d+ (re)
6 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 260
+ common: 0
+ missing: 260
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1340
+ common: 300
+ missing: 1040
common heads: 3ee37d65064a
$ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true --rev tip
comparing with b
@@ -465,6 +946,19 @@ One with >200 heads, which used to use u
searching: 3 queries
query 3; still undecided: 3, sample size is: 3
3 total queries in *.????s (glob)
+ heads summary:
+ total common heads: 1
+ also local heads: 0
+ also remote heads: 0
+ local heads: 260
+ common: 0
+ missing: 260
+ remote heads: 1
+ common: 0
+ unknown: 1
+ local changesets: 1340
+ common: 300
+ missing: 1040
common heads: 3ee37d65064a
Test actual protocol when pulling one new head in addition to common heads
More information about the Mercurial-devel
mailing list