/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/transform.py

  • Committer: Aaron Bentley
  • Date: 2009-07-12 01:17:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4538.
  • Revision ID: aaron@aaronbentley.com-20090712011751-b7pte3bi5hv7540m
Support committing a TreeTransform to a branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
859
859
        """
860
860
        return _PreviewTree(self)
861
861
 
 
862
    def commit(self, branch, message, merge_parents=None):
 
863
        """Commit the result of this TreeTransform to a branch.
 
864
 
 
865
        :param branch: The branch to commit to.
 
866
        :param message: The message to attach to the commit.
 
867
        :param merge_parents: Additional parents specified by pending merges.
 
868
        :return: The revision_id of the revision committed.
 
869
        """
 
870
        revno, last_rev_id = branch.last_revision_info()
 
871
        parent_ids = [last_rev_id]
 
872
        if merge_parents is not None:
 
873
            parent_ids.extend(merge_parents)
 
874
        if self._tree.get_revision_id() != last_rev_id:
 
875
            raise errors.WrongCommitBasis(self._tree)
 
876
        builder = branch.get_commit_builder(parent_ids)
 
877
        preview = self.get_preview_tree()
 
878
        list(builder.record_iter_changes(preview, last_rev_id,
 
879
                                         self.iter_changes()))
 
880
        builder.finish_inventory()
 
881
        revision_id = builder.commit(message)
 
882
        branch.set_last_revision_info(revno + 1, revision_id)
 
883
        return revision_id
 
884
 
862
885
    def _text_parent(self, trans_id):
863
886
        file_id = self.tree_file_id(trans_id)
864
887
        try: