Adding a pre-commit hook to Mercurial
Let's suppose you want to avoid committing an accidental:
import pdb; pdb.set_trace()
You can do that if you include this in your .hgrc:
[hooks]
pretxncommit.pdb = hg export tip | (! grep -E -q 'pdb')
Replace with the expression or regex you need and that's it, whenever you try to commit something that matches it'll fail with the pretxncommit.pdb message.
Written by Franco Mariluis
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#