comparison tests/test_svn_pre_commit_hooks.py @ 987:cf53cfaaa050

Fixes bug #358. Display correct error message if a svn pre-commit hook blocks the push
author Anton Agafonov <equeny@fb.com>
date Mon, 26 Nov 2012 11:38:34 -0800
parents
children d741f536f23a
comparison
equal deleted inserted replaced
986:1bdd075a490a 987:cf53cfaaa050
1 import os
2 import sys
3 import test_util
4 import unittest
5
6 from mercurial import hg
7 from mercurial import commands
8 from mercurial import util
9
10
11 class TestSvnPreCommitHooks(test_util.TestBase):
12 def setUp(self):
13 super(TestSvnPreCommitHooks, self).setUp()
14 self.repo_path = self.load_and_fetch('single_rev.svndump')[1]
15 # creating pre-commit hook that doesn't allow any commit
16 hook_file_name = os.path.join(
17 self.repo_path, 'hooks', 'pre-commit'
18 )
19 hook_file = open(hook_file_name, 'w')
20 hook_file.write(
21 '#!/bin/sh\n'
22 'echo "Commits are not allowed" >&2; exit 1;\n'
23 )
24 hook_file.close()
25 os.chmod(hook_file_name, 0755)
26
27 def test_push_with_pre_commit_hooks(self):
28 changes = [('narf/a', 'narf/a', 'ohai',),
29 ]
30 self.commitchanges(changes)
31 self.assertRaises(util.Abort, self.pushrevisions)
32
33 def suite():
34 return unittest.findTestCases(sys.modules[__name__])