/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2006-08-09 11:23:39 UTC
  • mto: (1908.6.2 use set_parent_trees.)
  • mto: This revision was merged to the branch mainline in revision 1972.
  • Revision ID: robertc@robertcollins.net-20060809112339-2fb0af74cc1495b7
Add WorkingTree.set_parent_ids.

Show diffs side-by-side

added added

removed removed

Lines of Context:
651
651
        :param revision_id: The revision id to add to the parent list. It may
652
652
        be a ghost revision.
653
653
        """
654
 
        revision_ids = self.get_parent_ids() + [revision_id]
655
 
        trees = []
656
 
        for rev_id in revision_ids:
657
 
            try:
658
 
                trees.append(
659
 
                    (rev_id, self.branch.repository.revision_tree(rev_id)))
660
 
            except errors.RevisionNotPresent:
661
 
                trees.append((rev_id, None))
662
 
                pass
663
 
        self.set_parent_trees(trees)
 
654
        self.set_parent_ids(self.get_parent_ids() + [revision_id])
664
655
 
665
656
    @needs_write_lock
666
657
    def add_pending_merge(self, *revision_ids):
693
684
        return p
694
685
 
695
686
    @needs_write_lock
 
687
    def set_parent_ids(self, revision_ids):
 
688
        """Set the parent ids to revision_ids.
 
689
        
 
690
        See also set_parent_trees. This api will try to retrieve the tree data
 
691
        for each element of revision_ids from the trees repository. If you have
 
692
        tree data already available, it is more efficient to use
 
693
        set_parent_trees rather than set_parent_ids. set_parent_ids is however
 
694
        an easier API to use.
 
695
 
 
696
        :param revision_ids: The revision_ids to set as the parent ids of this
 
697
            working tree. Any of these may be ghosts.
 
698
        """
 
699
        trees = []
 
700
        for rev_id in revision_ids:
 
701
            try:
 
702
                trees.append(
 
703
                    (rev_id, self.branch.repository.revision_tree(rev_id)))
 
704
            except errors.RevisionNotPresent:
 
705
                trees.append((rev_id, None))
 
706
                pass
 
707
        self.set_parent_trees(trees)
 
708
 
 
709
    @needs_write_lock
696
710
    def set_parent_trees(self, parents_list):
697
711
        """Set the parents of the working tree.
698
712