hgbook

view en/examples/hook.simple @ 139:ceaca14e49f0

Add local regexps to ignore bits of output.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue Mar 06 20:46:07 2007 -0800 (2007-03-06)
parents 6f37e6a7d8cd
children 627effec9d4e
line source
1 #!/bin/bash
3 #$ name: init
4 #$ ignore: [0-9a-f]{40}
6 hg init hook-test
7 cd hook-test
8 echo '[hooks]' >> .hg/hgrc
9 echo 'commit = echo committed $HG_NODE' >> .hg/hgrc
10 cat .hg/hgrc
11 echo a > a
12 hg add a
13 hg commit -m 'testing commit hook'
15 #$ name: ext
16 #$ ignore: ^date of commit.*
18 echo 'commit.when = echo -n "date of commit: "; date' >> .hg/hgrc
19 echo a >> a
20 hg commit -m 'i have two hooks'
22 #$ name:
24 echo '#!/bin/sh' >> check_bug_id
25 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id
26 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id
27 chmod +x check_bug_id
29 #$ name: pretxncommit
31 cat check_bug_id
33 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc
35 echo a >> a
36 hg commit -m 'i am not mentioning a bug id'
38 hg commit -m 'i refer you to bug 666'