bos@34: #$ name: init
bos@34: 
bos@34: hg init hook-test
bos@34: cd hook-test
bos@34: echo '[hooks]' >> .hg/hgrc
bos@34: echo 'commit = echo committed $HG_NODE' >> .hg/hgrc
bos@34: cat .hg/hgrc
bos@34: echo a > a
bos@34: hg add a
bos@34: hg commit -m 'testing commit hook'
bos@34: 
bos@34: #$ name: ext
bos@34: 
bos@34: echo 'commit.when = echo "date of commit:"; date' >> .hg/hgrc
bos@34: echo a >> a
bos@34: hg commit -m 'i have two hooks'
bos@34: 
bos@34: #$ name:
bos@34: 
bos@34: echo '#!/bin/sh' >> check_bug_id
bos@34: echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id
bos@34: echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id
bos@34: chmod +x check_bug_id
bos@34: 
bos@34: #$ name: pretxncommit
bos@34: 
bos@34: cat check_bug_id
bos@34: 
bos@34: echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc
bos@34: 
bos@34: echo a >> a
bos@34: hg commit -m 'i am not mentioning a bug id'
bos@34: 
bos@34: hg commit -m 'i refer you to bug 666'