~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2009-07-12 01:47:14 UTC
  • mto: This revision was merged to the branch mainline in revision 4538.
  • Revision ID: aaron@aaronbentley.com-20090712014714-2i7kwrbjz4ahc7tb
Proved strict commit handling.

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):
 
862
    def commit(self, branch, message, merge_parents=None, strict=False):
863
863
        """Commit the result of this TreeTransform to a branch.
864
864
 
865
865
        :param branch: The branch to commit to.
869
869
        """
870
870
        revno, last_rev_id = branch.last_revision_info()
871
871
        parent_ids = [last_rev_id]
 
872
        if strict:
 
873
            unversioned = set(self._new_contents).difference(set(self._new_id))
 
874
            for trans_id in unversioned:
 
875
                if self.final_file_id(trans_id) is None:
 
876
                    raise errors.StrictCommitFailed()
872
877
        if merge_parents is not None:
873
878
            parent_ids.extend(merge_parents)
874
879
        if self._tree.get_revision_id() != last_rev_id: