~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge cleanup into description

Show diffs side-by-side

added added

removed removed

Lines of Context:
668
668
 
669
669
    def test_commit_hook_template(self):
670
670
        # Test that commit template hooks work
671
 
        def restoreDefaults():
672
 
            msgeditor.hooks['commit_message_template'] = []
673
 
            osutils.set_or_unset_env('BZR_EDITOR', default_editor)
674
671
        if sys.platform == "win32":
675
672
            f = file('fed.bat', 'w')
676
673
            f.write('@rem dummy fed')
677
674
            f.close()
678
 
            default_editor = osutils.set_or_unset_env('BZR_EDITOR', "fed.bat")
 
675
            osutils.set_or_unset_env('BZR_EDITOR', "fed.bat")
679
676
        else:
680
677
            f = file('fed.sh', 'wb')
681
678
            f.write('#!/bin/sh\n')
682
679
            f.close()
683
680
            os.chmod('fed.sh', 0755)
684
 
            default_editor = osutils.set_or_unset_env('BZR_EDITOR', "./fed.sh")
685
 
        self.addCleanup(restoreDefaults)
 
681
            osutils.set_or_unset_env('BZR_EDITOR', "./fed.sh")
686
682
        msgeditor.hooks.install_named_hook("commit_message_template",
687
683
                lambda commit_obj, msg: "save me some typing\n", None)
688
684
        tree = self.make_branch_and_tree('tree')