~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_known_graph_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2009-08-26 16:03:59 UTC
  • mto: (4634.6.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: john@arbash-meinel.com-20090826160359-ge4mai928bi3a5g2
Fix bug #419241. If a graph had a mainline ghost
we could get a segfault during KnownGraph.merge_sort().

Show diffs side-by-side

added added

removed removed

Lines of Context:
443
443
        self.completed = 0
444
444
 
445
445
    def __repr__(self):
446
 
        return '%s(depth:%s rev:%s,%s,%s first:%s seen:%s)' % (self.__class__.__name__,
 
446
        return '%s(%s depth:%s rev:%s,%s,%s first:%s seen:%s)' % (
 
447
            self.__class__.__name__, self.key,
447
448
            self.merge_depth,
448
449
            self._revno_first, self._revno_second, self._revno_last,
449
450
            self.is_first_child, self.seen_by_child)
497
498
        if (tip_key is not None and tip_key != NULL_REVISION
498
499
            and tip_key != (NULL_REVISION,)):
499
500
            node = self.graph._nodes[tip_key]
500
 
            self._get_ms_node(node)
501
501
            self._push_node(node, 0)
502
502
 
503
503
    cdef _MergeSortNode _get_ms_node(self, _KnownGraphNode node):
518
518
 
519
519
        ms_node = self._get_ms_node(node)
520
520
        ms_node.merge_depth = merge_depth
 
521
        if node.parents is None:
 
522
            raise RuntimeError('ghost nodes should not be pushed'
 
523
                               ' onto the stack: %s' % (node,))
521
524
        if PyTuple_GET_SIZE(node.parents) > 0:
522
525
            parent_node = _get_parent(node.parents, 0)
523
526
            ms_node.left_parent = parent_node
524
 
            ms_node.left_pending_parent = parent_node
 
527
            if parent_node.parents is None: # left-hand ghost
 
528
                ms_node.left_pending_parent = None
 
529
                ms_node.left_parent = None
 
530
            else:
 
531
                ms_node.left_pending_parent = parent_node
525
532
        if PyTuple_GET_SIZE(node.parents) > 1:
526
533
            ms_node.pending_parents = []
527
534
            for pos from 1 <= pos < PyTuple_GET_SIZE(node.parents):