hgbook
view ja/examples/hook.simple.pretxncommit.out @ 1112:7764de86d22f
refined chap 2
author | Zhaoping Sun <zhaopingsun@gmail.com> |
---|---|
date | Mon Dec 28 22:58:53 2009 -0500 (2009-12-28) |
parents | |
children |
line source
1 $ \textbf{cat check_bug_id}
2 #!/bin/sh
3 # check that a commit comment mentions a numeric bug id
4 hg log -r $1 --template \{desc\} | grep -q "\textbackslash{}<bug *[0-9]"
5 $ \textbf{echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc}
6 $ \textbf{echo a >> a}
7 $ \textbf{hg commit -m 'i am not mentioning a bug id'}
8 transaction abort!
9 rollback completed
10 abort: pretxncommit.bug_id_required hook exited with status 1
11 $ \textbf{hg commit -m 'i refer you to bug 666'}
12 committed