~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2006-08-22 05:52:51 UTC
  • mto: (1908.6.6 use set_parent_trees.)
  • mto: This revision was merged to the branch mainline in revision 1972.
  • Revision ID: robertc@robertcollins.net-20060822055251-90587a0c3a067e09
Apply review feedback - paired with Martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
664
664
        and setting the list to its value plus revision_id.
665
665
 
666
666
        :param revision_id: The revision id to add to the parent list. It may
667
 
        be a ghost revision.
 
667
        be a ghost revision as long as its not the first parent to be added,
 
668
        or the allow_leftmost_as_ghost parameter is set True.
 
669
        :param allow_leftmost_as_ghost: Allow the first parent to be a ghost.
668
670
        """
669
671
        self.set_parent_ids(self.get_parent_ids() + [revision_id],
670
672
            allow_leftmost_as_ghost=allow_leftmost_as_ghost)
679
681
        simpler to use that api. If you have the parent already available, using
680
682
        this api is preferred.
681
683
 
682
 
        :param parent_tuple: The (revision id, tree) to add to the parent list.             If the revision_id is a ghost, pass None for the tree.
 
684
        :param parent_tuple: The (revision id, tree) to add to the parent list.
 
685
            If the revision_id is a ghost, pass None for the tree.
 
686
        :param allow_leftmost_as_ghost: Allow the first parent to be a ghost.
683
687
        """
684
688
        self.set_parent_ids(self.get_parent_ids() + [parent_tuple[0]],
685
689
            allow_leftmost_as_ghost=allow_leftmost_as_ghost)
737
741
                    (rev_id, self.branch.repository.revision_tree(rev_id)))
738
742
            except errors.RevisionNotPresent:
739
743
                trees.append((rev_id, None))
740
 
                pass
741
744
        self.set_parent_trees(trees,
742
745
            allow_leftmost_as_ghost=allow_leftmost_as_ghost)
743
746
 
749
752
            If tree is None, then that element is treated as an unreachable
750
753
            parent tree - i.e. a ghost.
751
754
        """
752
 
        parent = parents_list[:1]
753
 
        if len(parent):
 
755
        if len(parents_list) > 0:
 
756
            leftmost_id = parents_list[0][0]
754
757
            if (not allow_leftmost_as_ghost and not
755
 
                self.branch.repository.has_revision(parent[0][0])):
756
 
                raise errors.GhostRevision(parent[0][0])
757
 
            self.set_last_revision(parent[0][0])
 
758
                self.branch.repository.has_revision(leftmost_id)):
 
759
                raise errors.GhostRevisionUnusableHere(leftmost_id)
 
760
            self.set_last_revision(leftmost_id)
758
761
        else:
759
762
            self.set_last_revision(None)
760
763
        merges = parents_list[1:]