~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_commit.py

  • Committer: Robert Collins
  • Date: 2007-09-20 07:59:48 UTC
  • mto: (2840.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2842.
  • Revision ID: robertc@robertcollins.net-20070920075948-6f32d46hr3oyw4zb
Review feedback, and fix pointless commits with nested trees to raise PointlessCommit appropriately.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
 
91
91
    def test_commit_sets_last_revision(self):
92
92
        tree = self.make_branch_and_tree('tree')
93
 
        committed_id = tree.commit('foo', rev_id='foo', allow_pointless=True)
 
93
        committed_id = tree.commit('foo', rev_id='foo')
94
94
        self.assertEqual(['foo'], tree.get_parent_ids())
95
95
        # the commit should have returned the same id we asked for.
96
96
        self.assertEqual('foo', committed_id)
97
97
 
98
98
    def test_commit_returns_revision_id(self):
99
99
        tree = self.make_branch_and_tree('.')
100
 
        committed_id = tree.commit('message', allow_pointless=True)
 
100
        committed_id = tree.commit('message')
101
101
        self.assertTrue(tree.branch.repository.has_revision(committed_id))
102
102
        self.assertNotEqual(None, committed_id)
103
103
 
323
323
            basis.get_reference_revision(basis.path2id('subtree')))
324
324
        self.assertNotEqual(rev_id, rev_id2)
325
325
 
 
326
    def test_nested_pointless_commits_are_pointless(self):
 
327
        tree = self.make_branch_and_tree('.')
 
328
        if not tree.supports_tree_reference():
 
329
            # inapplicable test.
 
330
            return
 
331
        subtree = self.make_branch_and_tree('subtree')
 
332
        tree.add(['subtree'])
 
333
        # record the reference.
 
334
        rev_id = tree.commit('added reference')
 
335
        child_revid = subtree.last_revision()
 
336
        # now do a no-op commit with allow_pointless=False
 
337
        self.assertRaises(errors.PointlessCommit, tree.commit, '',
 
338
            allow_pointless=False)
 
339
        self.assertEqual(child_revid, subtree.last_revision())
 
340
        self.assertEqual(rev_id, tree.last_revision())
 
341
 
326
342
 
327
343
class TestCommitProgress(TestCaseWithWorkingTree):
328
344