mercurial/setdiscovery.py
changeset 15713 cff25e4b37d2
parent 15497 9bea3aed6ee1
child 16683 525fdb738975
equal deleted inserted replaced
15712:06b8b74720d6 15713:cff25e4b37d2
     7 # GNU General Public License version 2 or any later version.
     7 # GNU General Public License version 2 or any later version.
     8 
     8 
     9 from node import nullid
     9 from node import nullid
    10 from i18n import _
    10 from i18n import _
    11 import random, collections, util, dagutil
    11 import random, collections, util, dagutil
       
    12 import phases
    12 
    13 
    13 def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
    14 def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
    14     # if nodes is empty we scan the entire graph
    15     # if nodes is empty we scan the entire graph
    15     if nodes:
    16     if nodes:
    16         heads = dag.headsetofconnecteds(nodes)
    17         heads = dag.headsetofconnecteds(nodes)
    97     roundtrips += 1
    98     roundtrips += 1
    98     ownheads = dag.heads()
    99     ownheads = dag.heads()
    99     sample = ownheads
   100     sample = ownheads
   100     if remote.local():
   101     if remote.local():
   101         # stopgap until we have a proper localpeer that supports batch()
   102         # stopgap until we have a proper localpeer that supports batch()
   102         srvheadhashes = remote.heads()
   103         srvheadhashes = phases.visibleheads(remote)
   103         yesno = remote.known(dag.externalizeall(sample))
   104         yesno = remote.known(dag.externalizeall(sample))
   104     elif remote.capable('batch'):
   105     elif remote.capable('batch'):
   105         batch = remote.batch()
   106         batch = remote.batch()
   106         srvheadhashesref = batch.heads()
   107         srvheadhashesref = batch.heads()
   107         yesnoref = batch.known(dag.externalizeall(sample))
   108         yesnoref = batch.known(dag.externalizeall(sample))