Created
December 6, 2019 16:25
-
-
Save rifttech/0c55fe7bbee72adba6a2faf2cd692810 to your computer and use it in GitHub Desktop.
Mercurial - Hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| def no_cyrillic_hook(ui, repo, **kwargs): | |
| _changedFiles = [os.path.basename(file) for file in repo[kwargs['node']].changeset()[3]] | |
| for t in _changedFiles: | |
| try: | |
| t.decode('ascii') | |
| except UnicodeDecodeError: | |
| ui.warn("\nCyrillic Detected!") | |
| ui.warn("\nIllegal filename: " + t + "\n") | |
| return 1 | |
| else: | |
| pass | |
| return 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [hooks] | |
| pretxncommit = python:.hg/../custom_hooks.py:no_cyrillic_hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment