2018-01-03 22:51:20 +03:00
|
|
|
# no-check-code -- see T24862348
|
|
|
|
|
2012-11-26 23:38:34 +04:00
|
|
|
import os
|
2018-01-17 14:23:44 +03:00
|
|
|
import test_hgsubversion_util
|
2012-11-26 23:38:34 +04:00
|
|
|
|
|
|
|
from mercurial import util
|
|
|
|
|
|
|
|
|
2018-01-17 14:23:44 +03:00
|
|
|
class TestSvnPreCommitHooks(test_hgsubversion_util.TestBase):
|
2012-11-26 23:38:34 +04:00
|
|
|
def setUp(self):
|
|
|
|
super(TestSvnPreCommitHooks, self).setUp()
|
|
|
|
self.repo_path = self.load_and_fetch('single_rev.svndump')[1]
|
|
|
|
# creating pre-commit hook that doesn't allow any commit
|
|
|
|
hook_file_name = os.path.join(
|
2018-01-03 22:51:00 +03:00
|
|
|
self.repo_path, 'hooks', 'pre-commit'
|
2012-11-26 23:38:34 +04:00
|
|
|
)
|
|
|
|
hook_file = open(hook_file_name, 'w')
|
|
|
|
hook_file.write(
|
2018-01-03 22:51:00 +03:00
|
|
|
'#!/bin/sh\n'
|
|
|
|
'echo "Commits are not allowed" >&2; exit 1;\n'
|
2012-11-26 23:38:34 +04:00
|
|
|
)
|
|
|
|
hook_file.close()
|
|
|
|
os.chmod(hook_file_name, 0755)
|
|
|
|
|
|
|
|
def test_push_with_pre_commit_hooks(self):
|
|
|
|
changes = [('narf/a', 'narf/a', 'ohai',),
|
|
|
|
]
|
|
|
|
self.commitchanges(changes)
|
|
|
|
self.assertRaises(util.Abort, self.pushrevisions)
|