Last active
April 29, 2016 09:37
-
-
Save ngaranko/6b96f9f180b7b2003e8a79d496594bd5 to your computer and use it in GitHub Desktop.
Hg add branch name to commits
This file contains 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
def prefix_commit_message(repo, **kwargs): | |
commitctx = repo.commitctx | |
def rewrite_ctx(ctx, error): | |
branch_name = ctx.branch() | |
old_text = ctx._text | |
if branch_name not in old_text: | |
ctx._text = "{}: {}".format(branch_name, old_text) | |
return commitctx(ctx, error) | |
repo.commitctx = rewrite_ctx |
This file contains 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] | |
precommit = python:~/.hgco.py:prefix_commit_message | |
[alias] | |
co = commit -m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment