setdiscovery: drop '_setupsample' usage in '_takequicksample'
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 06 Jan 2015 17:07:44 -0800
changeset 23815 31e75a362d44
parent 23814 6a5877a73141
child 23816 34d4b58580d1
setdiscovery: drop '_setupsample' usage in '_takequicksample' For '_takefullsample' we can just retrieve the list of head directly and ignore the rest of the complex return values. This was the last call to the infamous '_updatesample' function.
mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py	Wed Jan 07 10:32:17 2015 -0800
+++ b/mercurial/setdiscovery.py	Tue Jan 06 17:07:44 2015 -0800
@@ -95,10 +95,9 @@
     return always, set(), desiredlen
 
 def _takequicksample(dag, nodes, size):
-    always, sample, desiredlen = _setupsample(dag, nodes, size)
-    if sample is None:
-        return always
-    sample = always
+    sample = dag.headsetofconnecteds(nodes)
+    if size <= len(sample):
+        return _limitsample(sample, size)
     _updatesample(dag, None, sample, quicksamplesize=size)
     return sample