Show More
@@ -385,6 +385,34 b' class obsstore(object):' | |||||
385 | if node.nullid in self.precursors: |
|
385 | if node.nullid in self.precursors: | |
386 | raise util.Abort(_('bad obsolescence marker detected: ' |
|
386 | raise util.Abort(_('bad obsolescence marker detected: ' | |
387 | 'invalid successors nullid')) |
|
387 | 'invalid successors nullid')) | |
|
388 | def relevantmarkers(self, nodes): | |||
|
389 | """return a set of all obsolescence markers relevant to a set of nodes. | |||
|
390 | ||||
|
391 | "relevant" to a set of nodes mean: | |||
|
392 | ||||
|
393 | - marker that use this changeset as successor | |||
|
394 | - prune marker of direct children on this changeset | |||
|
395 | - recursive application of the two rules on precursors of these markers | |||
|
396 | ||||
|
397 | It is a set so you cannot rely on order.""" | |||
|
398 | ||||
|
399 | pendingnodes = set(nodes) | |||
|
400 | seenmarkers = set() | |||
|
401 | seennodes = set(pendingnodes) | |||
|
402 | precursorsmarkers = self.precursors | |||
|
403 | children = self.children | |||
|
404 | while pendingnodes: | |||
|
405 | direct = set() | |||
|
406 | for current in pendingnodes: | |||
|
407 | direct.update(precursorsmarkers.get(current, ())) | |||
|
408 | pruned = [m for m in children.get(current, ()) if not m[1]] | |||
|
409 | direct.update(pruned) | |||
|
410 | direct -= seenmarkers | |||
|
411 | pendingnodes = set([m[0] for m in direct]) | |||
|
412 | seenmarkers |= direct | |||
|
413 | pendingnodes -= seennodes | |||
|
414 | seennodes |= pendingnodes | |||
|
415 | return seenmarkers | |||
388 |
|
416 | |||
389 | def _encodemarkers(markers, addheader=False): |
|
417 | def _encodemarkers(markers, addheader=False): | |
390 | # Kept separate from flushmarkers(), it will be reused for |
|
418 | # Kept separate from flushmarkers(), it will be reused for |
General Comments 0
You need to be logged in to leave comments.
Login now