, in-process hook, . hooks -.
-, python , . hook ui, repo hooktype . . pretrxncommit node, parent1 parent2, node, kwargs. ui .
check_comment.py:
import re
def check_comment(ui, repo, hooktype, node=None, **kwargs):
ui.status('Checking comment...\n')
comment = repo[node].description()
pattern = '^((Issue \d+:)|(No Issue:)).+'
if not re.match(pattern, comment, flags=re.IGNORECASE):
ui.warn('Comment does not match pattern. You must start it with "Issue 12323:" or "No Issue:"\n')
return True
hgrc python:/path/to/file.py:function_name, :
[hooks]
pretxncommit.check_comment = python:/path/to/check_comment.py:check_comment
.suffix_name pretxncommit , , hgrc, . - , .