setdiscovery: directly run '_updatesample'
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 07 Jan 2015 17:23:21 -0800
changeset 23812 db58186dd8e3
parent 23811 e2b262e2ee73
child 23813 932f814bf016
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.
mercurial/setdiscovery.py
tests/test-setdiscovery.t
--- 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
--- 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