Reputation: 189
I would like, when a user commit a changeset, to show a message mentioning the branch where the changeset was committed.
Example:
$hg commit -m 'Fix bug'
Changeset committed on branch bugfix
Do I actually need to modify the hg commit code or is it a quicker/simpler way of doing it?
Upvotes: 3
Views: 142
Reputation: 14023
ssg's answer is unfortunately not portable to e.g. Windows (because of the backticks), but this should work:
# UNIX-like
[hooks]
commit=hg log -r $HG_NODE --template "Committing on branch {branch}\n"
or
# Windows
[hooks]
commit=hg log -r %HG_NODE% --template "Committing on branch {branch}\n"
Upvotes: 5
Reputation: 47690
Add to your repository's .hg/hgrc:
[hooks]
commit=echo "Changeset committed on branch `hg branch`"
Upvotes: 8