Mercurial > hgbook
view en/examples/hook.simple.pretxncommit.out @ 167:e67251ac336f
Small portability change. "grep -P" doesn't work on Debian.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 27 Mar 2007 01:15:34 -0500 |
parents | 006bbad1f190 |
children | 00f69e8825c5 |
line wrap: on
line source
$ \textbf{cat check_bug_id} #!/bin/sh # check that a commit comment mentions a numeric bug id hg log -r $1 --template \{desc\} | grep -q "\textbackslash{}<bug *[0-9]" $ \textbf{echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc} $ \textbf{echo a >> a} $ \textbf{hg commit -m 'i am not mentioning a bug id'} abort: pretxncommit.bug_id_required hook exited with status 1 transaction abort! rollback completed $ \textbf{hg commit -m 'i refer you to bug 666'} committed