/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

Revamped set_parent* api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
644
644
        self._write_inventory(inv)
645
645
 
646
646
    @needs_write_lock
 
647
    def add_parent_tree_id(self, revision_id):
 
648
        """Add revision_id as a parent.
 
649
 
 
650
        This is equivalent to retrieving the current list of parent ids
 
651
        and setting the list to its value plus revision_id.
 
652
 
 
653
        :param revision_id: The revision id to add to the parent list. It may
 
654
        be a ghost revision.
 
655
        """
 
656
        self.set_parent_ids(self.get_parent_ids() + [revision_id])
 
657
 
 
658
    @needs_write_lock
647
659
    def add_pending_merge(self, *revision_ids):
648
660
        # TODO: Perhaps should check at this point that the
649
661
        # history of the revision is actually present?
674
686
        return p
675
687
 
676
688
    @needs_write_lock
 
689
    def set_parent_ids(self, revision_ids):
 
690
        """Set the parent ids to revision_ids.
 
691
        
 
692
        See also set_parent_trees. This api will try to retrieve the tree data
 
693
        for each element of revision_ids from the trees repository. If you have
 
694
        tree data already available, it is more efficient to use
 
695
        set_parent_trees rather than set_parent_ids. set_parent_ids is however
 
696
        an easier API to use.
 
697
 
 
698
        :param revision_ids: The revision_ids to set as the parent ids of this
 
699
            working tree. Any of these may be ghosts.
 
700
        """
 
701
        trees = []
 
702
        for rev_id in revision_ids:
 
703
            try:
 
704
                trees.append(
 
705
                    (rev_id, self.branch.repository.revision_tree(rev_id)))
 
706
            except errors.RevisionNotPresent:
 
707
                trees.append((rev_id, None))
 
708
                pass
 
709
        self.set_parent_trees(trees)
 
710
 
 
711
    @needs_write_lock
677
712
    def set_parent_trees(self, parents_list):
678
713
        """Set the parents of the working tree.
679
714