# HG changeset patch # User Pierre-Yves David # Date 1420680201 28800 # Node ID db58186dd8e3ad35fb451916c262a43a6e7d524e # Parent e2b262e2ee73f4db6867ec60e98ce766e5f3d095 setdiscovery: directly run '_updatesample' The heads and exponential sample are going to end up in the same set before any extra processing happens. We simplify the code by directly updating a set with heads. Changes in the order the set is built lead to small changes in the random sampling output. But after double checking, I can confirm the input data to the random sampling is consistent. diff -r e2b262e2ee73 -r db58186dd8e3 mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py Wed Jan 07 17:17:56 2015 -0800 +++ b/mercurial/setdiscovery.py Wed Jan 07 17:23:21 2015 -0800 @@ -108,7 +108,7 @@ always = dag.headsetofconnecteds(nodes) if size <= len(always): return always - sample = set() + sample = always # update from heads _updatesample(dag, nodes, sample, always) # update from roots diff -r e2b262e2ee73 -r db58186dd8e3 tests/test-setdiscovery.t --- a/tests/test-setdiscovery.t Wed Jan 07 17:17:56 2015 -0800 +++ b/tests/test-setdiscovery.t Wed Jan 07 17:23:21 2015 -0800 @@ -326,7 +326,7 @@ query 6; still undecided: 540, sample size is: 200 sampling from both directions searching: 7 queries - query 7; still undecided: 37, sample size is: 37 + query 7; still undecided: 46, sample size is: 46 7 total queries common heads: 3ee37d65064a