##// END OF EJS Templates
discovery: move missing tracking inside the partialdiscovery object...
Boris Feld -
r41206:96201120 default
parent child Browse files
Show More
@@ -169,6 +169,7 b' class partialdiscovery(object):'
169 169
170 170 - common: own nodes I know we both know
171 171 - undecided: own nodes where I don't know if remote knows them
172 - missing: own nodes I know remote lacks
172 173 """
173 174
174 175 def __init__(self, repo, targetheads):
@@ -176,12 +177,24 b' class partialdiscovery(object):'
176 177 self._targetheads = targetheads
177 178 self._common = repo.changelog.incrementalmissingrevs()
178 179 self._undecided = None
180 self.missing = set()
179 181
180 182 def addcommons(self, commons):
181 183 """registrer nodes known as common"""
182 184 self._common.addbases(commons)
183 185 self._common.removeancestorsfrom(self.undecided)
184 186
187 def addmissings(self, missings):
188 """registrer some nodes as missing"""
189 if self.missing:
190 new = self._repo.revs('descendants(%ld) - descendants(%ld)',
191 missings, self.missing)
192 self.missing.update(new)
193 else:
194 self.missing.update(self._repo.revs('descendants(%ld)', missings))
195
196 self.undecided.difference_update(self.missing)
197
185 198 def hasinfo(self):
186 199 """return True is we have any clue about the remote state"""
187 200 return self._common.hasbases()
@@ -277,8 +290,6 b' def findcommonheads(ui, local, remote,'
277 290 disco.addcommons(srvheads)
278 291 commoninsample = set(n for i, n in enumerate(sample) if yesno[i])
279 292 disco.addcommons(commoninsample)
280 # own nodes I know remote lacks
281 missing = set()
282 293
283 294 full = False
284 295 progress = ui.makeprogress(_('searching'), unit=_('queries'))
@@ -286,14 +297,8 b' def findcommonheads(ui, local, remote,'
286 297
287 298 if sample:
288 299 missinginsample = [n for i, n in enumerate(sample) if not yesno[i]]
300 disco.addmissings(missinginsample)
289 301
290 if missing:
291 missing.update(local.revs('descendants(%ld) - descendants(%ld)',
292 missinginsample, missing))
293 else:
294 missing.update(local.revs('descendants(%ld)', missinginsample))
295
296 disco.undecided.difference_update(missing)
297 302
298 303 if disco.iscomplete():
299 304 break
General Comments 0
You need to be logged in to leave comments. Login now