Mercurial > hg
comparison mercurial/setdiscovery.py @ 25914:4d77e89652ad
discovery: always use batching now that all peers support batching
Some peers will transparently downgrade batched requests to
non-batched ones, but that simplifies code for everyone using
batching.
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 05 Aug 2015 14:21:46 -0400 |
parents | 6eb4bdad198f |
children | fb5664eb8414 |
comparison
equal
deleted
inserted
replaced
25913:fa14ba7b9667 | 25914:4d77e89652ad |
---|---|
136 roundtrips += 1 | 136 roundtrips += 1 |
137 ownheads = dag.heads() | 137 ownheads = dag.heads() |
138 sample = _limitsample(ownheads, initialsamplesize) | 138 sample = _limitsample(ownheads, initialsamplesize) |
139 # indices between sample and externalized version must match | 139 # indices between sample and externalized version must match |
140 sample = list(sample) | 140 sample = list(sample) |
141 if remote.local(): | 141 batch = remote.batch() |
142 # stopgap until we have a proper localpeer that supports batch() | 142 srvheadhashesref = batch.heads() |
143 srvheadhashes = remote.heads() | 143 yesnoref = batch.known(dag.externalizeall(sample)) |
144 yesno = remote.known(dag.externalizeall(sample)) | 144 batch.submit() |
145 elif remote.capable('batch'): | 145 srvheadhashes = srvheadhashesref.value |
146 batch = remote.batch() | 146 yesno = yesnoref.value |
147 srvheadhashesref = batch.heads() | |
148 yesnoref = batch.known(dag.externalizeall(sample)) | |
149 batch.submit() | |
150 srvheadhashes = srvheadhashesref.value | |
151 yesno = yesnoref.value | |
152 else: | |
153 # compatibility with pre-batch, but post-known remotes during 1.9 | |
154 # development | |
155 srvheadhashes = remote.heads() | |
156 sample = [] | |
157 | 147 |
158 if cl.tip() == nullid: | 148 if cl.tip() == nullid: |
159 if srvheadhashes != [nullid]: | 149 if srvheadhashes != [nullid]: |
160 return [nullid], True, srvheadhashes | 150 return [nullid], True, srvheadhashes |
161 return [nullid], False, [] | 151 return [nullid], False, [] |