860
860
return _PreviewTree(self)
862
def commit(self, branch, message, merge_parents=None):
863
"""Commit the result of this TreeTransform to a branch.
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.
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)
862
885
def _text_parent(self, trans_id):
863
886
file_id = self.tree_file_id(trans_id)