summaryrefslogtreecommitdiff
path: root/mercurial/setdiscovery.py
diff options
context:
space:
mode:
Diffstat (limited to 'mercurial/setdiscovery.py')
-rw-r--r--mercurial/setdiscovery.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
index 94d8bb0..c737db8 100644
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -8,7 +8,7 @@
from node import nullid
from i18n import _
-import random, util, dagutil
+import random, collections, util, dagutil
def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
# if nodes is empty we scan the entire graph
@@ -17,7 +17,7 @@ def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
else:
heads = dag.heads()
dist = {}
- visit = util.deque(heads)
+ visit = collections.deque(heads)
seen = set()
factor = 1
while visit:
@@ -128,21 +128,16 @@ def findcommonheads(ui, local, remote,
return (srvheadhashes, False, srvheadhashes,)
if sample and util.all(yesno):
- ui.note(_("all local heads known remotely\n"))
+ ui.note("all local heads known remotely\n")
ownheadhashes = dag.externalizeall(ownheads)
return (ownheadhashes, True, srvheadhashes,)
# full blown discovery
+ undecided = dag.nodeset() # own nodes where I don't know if remote knows them
+ common = set() # own nodes I know we both know
+ missing = set() # own nodes I know remote lacks
- # own nodes where I don't know if remote knows them
- undecided = dag.nodeset()
- # own nodes I know we both know
- common = set()
- # own nodes I know remote lacks
- missing = set()
-
- # treat remote heads (and maybe own heads) as a first implicit sample
- # response
+ # treat remote heads (and maybe own heads) as a first implicit sample response
common.update(dag.ancestorset(srvheads))
undecided.difference_update(common)
@@ -163,7 +158,7 @@ def findcommonheads(ui, local, remote,
break
if full:
- ui.note(_("sampling from both directions\n"))
+ ui.note("sampling from both directions\n")
sample = _takefullsample(dag, undecided, size=fullsamplesize)
elif common:
# use cheapish initial sample