Show More
@@ -470,6 +470,25 b' class marker(object):' | |||
|
470 | 470 | """The flags field of the marker""" |
|
471 | 471 | return self._data[2] |
|
472 | 472 | |
|
473 | @util.nogc | |
|
474 | def _addsuccessors(successors, markers): | |
|
475 | for mark in markers: | |
|
476 | successors.setdefault(mark[0], set()).add(mark) | |
|
477 | ||
|
478 | @util.nogc | |
|
479 | def _addprecursors(precursors, markers): | |
|
480 | for mark in markers: | |
|
481 | for suc in mark[1]: | |
|
482 | precursors.setdefault(suc, set()).add(mark) | |
|
483 | ||
|
484 | @util.nogc | |
|
485 | def _addchildren(children, markers): | |
|
486 | for mark in markers: | |
|
487 | parents = mark[5] | |
|
488 | if parents is not None: | |
|
489 | for p in parents: | |
|
490 | children.setdefault(p, set()).add(mark) | |
|
491 | ||
|
473 | 492 | def _checkinvalidmarkers(obsstore): |
|
474 | 493 | """search for marker with invalid data and raise error if needed |
|
475 | 494 | |
@@ -604,18 +623,12 b' class obsstore(object):' | |||
|
604 | 623 | version, markers = _readmarkers(data) |
|
605 | 624 | return self.add(transaction, markers) |
|
606 | 625 | |
|
607 | @util.nogc | |
|
608 | 626 | def _load(self, markers): |
|
609 | for mark in markers: | |
|
610 |
|
|
|
611 | pre, sucs = mark[:2] | |
|
612 | self.successors.setdefault(pre, set()).add(mark) | |
|
613 | for suc in sucs: | |
|
614 | self.precursors.setdefault(suc, set()).add(mark) | |
|
615 | parents = mark[5] | |
|
616 | if parents is not None: | |
|
617 | for p in parents: | |
|
618 | self.children.setdefault(p, set()).add(mark) | |
|
627 | markers = list(markers) # to allow repeated iteration | |
|
628 | self._all.extend(markers) | |
|
629 | _addsuccessors(self.successors, markers) | |
|
630 | _addprecursors(self.precursors, markers) | |
|
631 | _addchildren(self.children, markers) | |
|
619 | 632 | _checkinvalidmarkers(self) |
|
620 | 633 | |
|
621 | 634 | def relevantmarkers(self, nodes): |
General Comments 0
You need to be logged in to leave comments.
Login now