~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tsort.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-28 06:40:33 UTC
  • mfrom: (4596.1.7 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090828064033-q7eyzxnnyc3jcpag
(mbp) merge 1.18 and 2.0 back to trunk; bump version to 2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
459
459
            left_subtree_pushed_stack_append(False)
460
460
            pending_parents_stack_append(list(parents))
461
461
            # as we push it, check if it is the first child
 
462
            parent_info = None
462
463
            if parents:
463
464
                # node has parents, assign from the left most parent.
464
 
                parent_info = revnos[parents[0]]
 
465
                try:
 
466
                    parent_info = revnos[parents[0]]
 
467
                except KeyError:
 
468
                    # Left-hand parent is a ghost, consider it not to exist
 
469
                    pass
 
470
            if parent_info is not None:
465
471
                first_child = parent_info[1]
466
472
                parent_info[1] = False
467
473
            else:
495
501
            pending_parents_stack_pop()
496
502
 
497
503
            parents = original_graph[node_name]
 
504
            parent_revno = None
498
505
            if parents:
499
506
                # node has parents, assign from the left most parent.
500
 
                parent_revno = revnos[parents[0]][0]
 
507
                try:
 
508
                    parent_revno = revnos[parents[0]][0]
 
509
                except KeyError:
 
510
                    # left-hand parent is a ghost, treat it as not existing
 
511
                    pass
 
512
            if parent_revno is not None:
501
513
                if not first_child:
502
514
                    # not the first child, make a new branch
503
515
                    base_revno = parent_revno[0]
628
640
        self._left_subtree_pushed_stack.append(False)
629
641
        self._pending_parents_stack.append(list(parents))
630
642
        # as we push it, figure out if this is the first child
631
 
        parents = self._original_graph[node_name]
 
643
        parent_info = None
632
644
        if parents:
633
645
            # node has parents, assign from the left most parent.
634
 
            parent_info = self._revnos[parents[0]]
 
646
            try:
 
647
                parent_info = self._revnos[parents[0]]
 
648
            except KeyError:
 
649
                # Left-hand parent is a ghost, consider it not to exist
 
650
                pass
 
651
        if parent_info is not None:
635
652
            first_child = parent_info[1]
636
653
            parent_info[1] = False
637
654
        else:
655
672
        self._pending_parents_stack.pop()
656
673
 
657
674
        parents = self._original_graph[node_name]
 
675
        parent_revno = None
658
676
        if parents:
659
677
            # node has parents, assign from the left most parent.
660
 
            parent_revno = self._revnos[parents[0]][0]
 
678
            try:
 
679
                parent_revno = self._revnos[parents[0]][0]
 
680
            except KeyError:
 
681
                # left-hand parent is a ghost, treat it as not existing
 
682
                pass
 
683
        if parent_revno is not None:
661
684
            if not first_child:
662
685
                # not the first child, make a new branch
663
686
                base_revno = parent_revno[0]