~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branchbuilder.py

  • Committer: Robert Collins
  • Date: 2007-04-27 03:02:05 UTC
  • mto: (2495.3.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2498.
  • Revision ID: robertc@robertcollins.net-20070427030205-ll4s3d57mf0dcaqk
Add BranchBuilder.build_commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
        self.assertEqual(
42
42
            (0, _mod_revision.NULL_REVISION),
43
43
            branch.last_revision_info())
 
44
 
 
45
    def test_build_one_commit(self):
 
46
        """doing build_commit causes a commit to happen."""
 
47
        builder = BranchBuilder(self.get_transport().clone('foo'))
 
48
        builder.build_commit()
 
49
        branch = builder.get_branch()
 
50
        self.assertEqual(1, branch.last_revision_info()[0])
 
51
        # we dont care what the revision id is.
 
52
        self.assertEqual(
 
53
            'commit 1',
 
54
            branch.repository.get_revision(branch.last_revision()).message)
 
55
 
 
56
    def test_build_two_commits(self):
 
57
        """The second commit has the right parents and message."""
 
58
        builder = BranchBuilder(self.get_transport().clone('foo'))
 
59
        builder.build_commit()
 
60
        builder.build_commit()
 
61
        branch = builder.get_branch()
 
62
        self.assertEqual(2, branch.last_revision_info()[0])
 
63
        # we dont care what the revision id is.
 
64
        self.assertEqual(
 
65
            'commit 2',
 
66
            branch.repository.get_revision(branch.last_revision()).message)
 
67
        self.assertEqual(
 
68
            [branch.revision_history()[0]],
 
69
            branch.repository.get_revision(branch.last_revision()).parent_ids)