equal
deleted
inserted
replaced
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)) |