changeset 46076:0e5065b6baa0

debugdiscovery: display some information about the initial "undecided" set The size and shape of the revision that remains "undediced" once the fetched the remote heads and queried the local one have a large impact on the discovery performance, so we display some information about that set. Differential Revision: https://phab.mercurial-scm.org/D9530
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 06 Dec 2020 14:45:19 +0100
parents 3ca9d26c5984
children 7a2b67e6b680
files mercurial/debugcommands.py tests/test-setdiscovery.t
diffstat 2 files changed, 213 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sun Dec 06 06:19:15 2020 +0100
+++ b/mercurial/debugcommands.py	Sun Dec 06 14:45:19 2020 +0100
@@ -1034,6 +1034,14 @@
     roots_missing = repo.revs(b'roots(%ld)', missing)
     assert len(common) + len(missing) == len(all)
 
+    initial_undecided = repo.revs(
+        b'not (::%ln or %ln::)', heads_common_remote, heads_common_local
+    )
+    heads_initial_undecided = repo.revs(b'heads(%ld)', initial_undecided)
+    roots_initial_undecided = repo.revs(b'roots(%ld)', initial_undecided)
+    common_initial_undecided = initial_undecided & common
+    missing_initial_undecided = initial_undecided & missing
+
     data = {}
     data[b'elapsed'] = t.elapsed
     data[b'nb-common-heads'] = len(heads_common)
@@ -1052,6 +1060,11 @@
     data[b'nb-revs-missing'] = len(missing)
     data[b'nb-missing-heads'] = len(roots_missing)
     data[b'nb-missing-roots'] = len(heads_missing)
+    data[b'nb-ini_und'] = len(initial_undecided)
+    data[b'nb-ini_und-heads'] = len(heads_initial_undecided)
+    data[b'nb-ini_und-roots'] = len(roots_initial_undecided)
+    data[b'nb-ini_und-common'] = len(common_initial_undecided)
+    data[b'nb-ini_und-missing'] = len(missing_initial_undecided)
 
     # display discovery summary
     ui.writenoi18n(b"elapsed time:  %(elapsed)f seconds\n" % data)
@@ -1085,6 +1098,11 @@
     ui.writenoi18n(b"  missing:             %(nb-revs-missing)9d\n" % data)
     ui.writenoi18n(b"    heads:             %(nb-missing-heads)9d\n" % data)
     ui.writenoi18n(b"    roots:             %(nb-missing-roots)9d\n" % data)
+    ui.writenoi18n(b"  first undecided set: %(nb-ini_und)9d\n" % data)
+    ui.writenoi18n(b"    heads:             %(nb-ini_und-heads)9d\n" % data)
+    ui.writenoi18n(b"    roots:             %(nb-ini_und-roots)9d\n" % data)
+    ui.writenoi18n(b"    common:            %(nb-ini_und-common)9d\n" % data)
+    ui.writenoi18n(b"    missing:           %(nb-ini_und-missing)9d\n" % data)
 
     if ui.verbose:
         ui.writenoi18n(
--- a/tests/test-setdiscovery.t	Sun Dec 06 06:19:15 2020 +0100
+++ b/tests/test-setdiscovery.t	Sun Dec 06 14:45:19 2020 +0100
@@ -62,6 +62,11 @@
     missing:                     0
       heads:                     0
       roots:                     0
+    first undecided set:         3
+      heads:                     1
+      roots:                     1
+      common:                    3
+      missing:                   0
   common heads: 01241442b3c2 b5714e113bc0
   
   % -- a -> b set
@@ -88,6 +93,11 @@
     missing:                     0
       heads:                     0
       roots:                     0
+    first undecided set:         3
+      heads:                     1
+      roots:                     1
+      common:                    3
+      missing:                   0
   common heads: 01241442b3c2 b5714e113bc0
   
   % -- a -> b set (tip only)
@@ -114,6 +124,11 @@
     missing:                     1
       heads:                     1
       roots:                     1
+    first undecided set:         6
+      heads:                     2
+      roots:                     1
+      common:                    5
+      missing:                   1
   common heads: b5714e113bc0
   
   % -- b -> a tree
@@ -139,6 +154,11 @@
     missing:                     8
       heads:                     2
       roots:                     2
+    first undecided set:         8
+      heads:                     2
+      roots:                     2
+      common:                    0
+      missing:                   8
   common heads: 01241442b3c2 b5714e113bc0
   
   % -- b -> a set
@@ -165,6 +185,11 @@
     missing:                     8
       heads:                     2
       roots:                     2
+    first undecided set:         8
+      heads:                     2
+      roots:                     2
+      common:                    0
+      missing:                   8
   common heads: 01241442b3c2 b5714e113bc0
   
   % -- b -> a set (tip only)
@@ -191,6 +216,11 @@
     missing:                     8
       heads:                     2
       roots:                     2
+    first undecided set:         8
+      heads:                     2
+      roots:                     2
+      common:                    0
+      missing:                   8
   common heads: 01241442b3c2 b5714e113bc0
 
 
@@ -223,6 +253,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        34
+      heads:                     2
+      roots:                     1
+      common:                    4
+      missing:                  30
   common heads: bebd167eb94d
   
   % -- a -> b set
@@ -252,6 +287,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        34
+      heads:                     2
+      roots:                     1
+      common:                    4
+      missing:                  30
   common heads: bebd167eb94d
   
   % -- a -> b set (tip only)
@@ -281,6 +321,11 @@
     missing:                    33
       heads:                     2
       roots:                     2
+    first undecided set:        35
+      heads:                     2
+      roots:                     1
+      common:                    2
+      missing:                  33
   common heads: 66f7d451a68b
   
   % -- b -> a tree
@@ -306,6 +351,11 @@
     missing:                     3
       heads:                     1
       roots:                     1
+    first undecided set:         3
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                   3
   common heads: bebd167eb94d
   
   % -- b -> a set
@@ -335,6 +385,11 @@
     missing:                     3
       heads:                     1
       roots:                     1
+    first undecided set:         3
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                   3
   common heads: bebd167eb94d
   
   % -- b -> a set (tip only)
@@ -364,6 +419,11 @@
     missing:                     3
       heads:                     1
       roots:                     1
+    first undecided set:         3
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                   3
   common heads: bebd167eb94d
 
 Both sides many new with stub:
@@ -395,6 +455,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        33
+      heads:                     2
+      roots:                     1
+      common:                    3
+      missing:                  30
   common heads: 2dc09a01254d
   
   % -- a -> b set
@@ -424,6 +489,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        33
+      heads:                     2
+      roots:                     1
+      common:                    3
+      missing:                  30
   common heads: 2dc09a01254d
   
   % -- a -> b set (tip only)
@@ -453,6 +523,11 @@
     missing:                    32
       heads:                     2
       roots:                     2
+    first undecided set:        34
+      heads:                     2
+      roots:                     1
+      common:                    2
+      missing:                  32
   common heads: 66f7d451a68b
   
   % -- b -> a tree
@@ -478,6 +553,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        30
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                  30
   common heads: 2dc09a01254d
   
   % -- b -> a set
@@ -507,6 +587,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        30
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                  30
   common heads: 2dc09a01254d
   
   % -- b -> a set (tip only)
@@ -536,6 +621,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        30
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                  30
   common heads: 2dc09a01254d
 
 
@@ -568,6 +658,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- a -> b set
@@ -597,6 +692,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- a -> b set (tip only)
@@ -626,6 +726,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- b -> a tree
@@ -651,6 +756,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- b -> a set
@@ -680,6 +790,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- b -> a set (tip only)
@@ -709,6 +824,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
 
 
@@ -741,6 +861,11 @@
     missing:                    50
       heads:                     1
       roots:                     1
+    first undecided set:        52
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  50
   common heads: 66f7d451a68b
   
   % -- a -> b set
@@ -770,6 +895,11 @@
     missing:                    50
       heads:                     1
       roots:                     1
+    first undecided set:        52
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  50
   common heads: 66f7d451a68b
   
   % -- a -> b set (tip only)
@@ -799,6 +929,11 @@
     missing:                    50
       heads:                     1
       roots:                     1
+    first undecided set:        52
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  50
   common heads: 66f7d451a68b
   
   % -- b -> a tree
@@ -824,6 +959,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- b -> a set
@@ -853,6 +993,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
   
   % -- b -> a set (tip only)
@@ -882,6 +1027,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:        32
+      heads:                     1
+      roots:                     1
+      common:                    2
+      missing:                  30
   common heads: 66f7d451a68b
 
 
@@ -914,6 +1064,11 @@
     missing:                    50
       heads:                     1
       roots:                     1
+    first undecided set:      1050
+      heads:                     1
+      roots:                     1
+      common:                 1000
+      missing:                  50
   common heads: 7ead0cba2838
   
   % -- a -> b set
@@ -946,6 +1101,11 @@
     missing:                    50
       heads:                     1
       roots:                     1
+    first undecided set:      1050
+      heads:                     1
+      roots:                     1
+      common:                 1000
+      missing:                  50
   common heads: 7ead0cba2838
   
   % -- a -> b set (tip only)
@@ -978,6 +1138,11 @@
     missing:                    50
       heads:                     1
       roots:                     1
+    first undecided set:      1050
+      heads:                     1
+      roots:                     1
+      common:                 1000
+      missing:                  50
   common heads: 7ead0cba2838
   
   % -- b -> a tree
@@ -1003,6 +1168,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:      1030
+      heads:                     1
+      roots:                     1
+      common:                 1000
+      missing:                  30
   common heads: 7ead0cba2838
   
   % -- b -> a set
@@ -1035,6 +1205,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:      1030
+      heads:                     1
+      roots:                     1
+      common:                 1000
+      missing:                  30
   common heads: 7ead0cba2838
   
   % -- b -> a set (tip only)
@@ -1067,6 +1242,11 @@
     missing:                    30
       heads:                     1
       roots:                     1
+    first undecided set:      1030
+      heads:                     1
+      roots:                     1
+      common:                 1000
+      missing:                  30
   common heads: 7ead0cba2838
 
 
@@ -1151,6 +1331,11 @@
     missing:                  1040
       heads:                   260
       roots:                   260
+    first undecided set:      1340
+      heads:                   260
+      roots:                     1
+      common:                  300
+      missing:                1040
   common heads: 3ee37d65064a
   $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true --rev tip
   comparing with b
@@ -1182,6 +1367,11 @@
     missing:                  1040
       heads:                   260
       roots:                   260
+    first undecided set:      1340
+      heads:                   260
+      roots:                     1
+      common:                  300
+      missing:                1040
   common heads: 3ee37d65064a
 
 Test actual protocol when pulling one new head in addition to common heads
@@ -1304,4 +1494,9 @@
     missing:                     1
       heads:                     1
       roots:                     1
+    first undecided set:         1
+      heads:                     1
+      roots:                     1
+      common:                    0
+      missing:                   1
   common heads: 66f7d451a68b