/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/tests/test_commit.py

  • Committer: Aaron Bentley
  • Date: 2009-05-19 09:14:07 UTC
  • mto: This revision was merged to the branch mainline in revision 4374.
  • Revision ID: aaron@aaronbentley.com-20090519091407-u6gnpr6uj9e0rbju
Trivial support for committing PreviewTree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    lockdir,
25
25
    osutils,
26
26
    tests,
 
27
    transform,
27
28
    )
28
29
from bzrlib.branch import Branch
29
30
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
799
800
        tree2 = branch.create_checkout('repo/tree2')
800
801
        tree2.commit('message', rev_id='rev1')
801
802
        self.assertTrue(tree2.branch.repository.has_revision('rev1'))
 
803
 
 
804
    def test_commit_preview_tree(self):
 
805
        tree = self.make_branch_and_tree('tree')
 
806
        rev_id = tree.commit('rev1')
 
807
        tree.branch.lock_write()
 
808
        self.addCleanup(tree.branch.unlock)
 
809
        tt = transform.TransformPreview(tree)
 
810
        self.addCleanup(tt.finalize)
 
811
        preview = tt.get_preview_tree(tree.branch.repository)
 
812
        preview.set_parent_ids([rev_id])
 
813
        Commit().commit('rev2', working_tree=preview,
 
814
                        target_branch=tree.branch)
 
815
 
 
816
    def test_target_branch(self):
 
817
        tree = self.make_branch_and_tree('tree')
 
818
        tree.commit('rev1')
 
819
        target = tree.bzrdir.sprout('target').open_branch()
 
820
        rev = Commit().commit('rev2', working_tree=tree, target_branch=target)
 
821
        self.assertRaises(errors.NoSuchRevision,
 
822
                          tree.branch.repository.get_revision, rev)
 
823
        target.repository.get_revision(rev)