sapling/tests/test-hgsubversion-svn-pre-commit-hooks.py
Jun Wu a487dacc4b codemod: reformat rest of the code
Summary:
Previous code format attempt (D8173629) didn't cover all files due to `**/*.py`
was not expanded recursively by bash. That makes certain changes larger than
they should be (ex. D8675439). Now use zsh's `**/*.py` to format them.

Also fix Python syntax so black can run on more files, and all lint issues.

Reviewed By: phillco

Differential Revision: D8696912

fbshipit-source-id: 95f07aa0c5eb1b63947b0f77f534957f4ab65364
2018-07-05 17:52:43 -07:00

30 lines
934 B
Python

# no-check-code -- see T24862348
import os
import test_hgsubversion_util
from mercurial import util
class TestSvnPreCommitHooks(test_hgsubversion_util.TestBase):
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(self.repo_path, "hooks", "pre-commit")
hook_file = open(hook_file_name, "w")
hook_file.write("#!/bin/sh\n" 'echo "Commits are not allowed" >&2; exit 1;\n')
hook_file.close()
os.chmod(hook_file_name, 0o755)
def test_push_with_pre_commit_hooks(self):
changes = [("narf/a", "narf/a", "ohai")]
self.commitchanges(changes)
self.assertRaises(util.Abort, self.pushrevisions)
if __name__ == "__main__":
import silenttestrunner
silenttestrunner.main(__name__)