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

  • Committer: Martin Pool
  • Date: 2009-09-11 07:55:48 UTC
  • mfrom: (4634.43.1 2.0)
  • mto: This revision was merged to the branch mainline in revision 4689.
  • Revision ID: mbp@sourcefrog.net-20090911075548-kzznjy7emvpqnz1n
merge 2.0rc2, sphinx, and various fixes back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
611
611
        revid = tree.commit('first post')
612
612
        committed_tree = tree.basis_tree()
613
613
        self.assertTrue(committed_tree.has_filename("newfile"))
 
614
 
 
615
    def test_post_commit_hook(self):
 
616
        """Make sure a post_commit hook is called after a commit."""
 
617
        def post_commit_hook_test_params(params):
 
618
            self.assertTrue(isinstance(params,
 
619
                mutabletree.PostCommitHookParams))
 
620
            self.assertTrue(isinstance(params.mutable_tree,
 
621
                mutabletree.MutableTree))
 
622
            open(tree.abspath("newfile"), 'w').write("data")
 
623
            params.mutable_tree.add(["newfile"])
 
624
        def restoreDefaults():
 
625
            mutabletree.MutableTree.hooks['post_commit'] = []
 
626
        self.addCleanup(restoreDefaults)
 
627
        tree = self.make_branch_and_tree('.')
 
628
        mutabletree.MutableTree.hooks.install_named_hook(
 
629
            'post_commit',
 
630
            post_commit_hook_test_params,
 
631
            None)
 
632
        self.assertFalse(tree.has_filename("newfile"))
 
633
        revid = tree.commit('first post')
 
634
        self.assertTrue(tree.has_filename("newfile"))
 
635
        committed_tree = tree.basis_tree()
 
636
        self.assertFalse(committed_tree.has_filename("newfile"))