hgbook

view en/examples/hook.simple @ 47:6f37e6a7d8cd

Get Emacs to figure out what syntax highlighting to use for examples.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun Jul 23 23:38:41 2006 -0700 (2006-07-23)
parents 5cee64874312
children ceaca14e49f0
line source
1 #!/bin/bash
3 #$ name: init
5 hg init hook-test
6 cd hook-test
7 echo '[hooks]' >> .hg/hgrc
8 echo 'commit = echo committed $HG_NODE' >> .hg/hgrc
9 cat .hg/hgrc
10 echo a > a
11 hg add a
12 hg commit -m 'testing commit hook'
14 #$ name: ext
16 echo 'commit.when = echo "date of commit:"; date' >> .hg/hgrc
17 echo a >> a
18 hg commit -m 'i have two hooks'
20 #$ name:
22 echo '#!/bin/sh' >> check_bug_id
23 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id
24 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id
25 chmod +x check_bug_id
27 #$ name: pretxncommit
29 cat check_bug_id
31 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc
33 echo a >> a
34 hg commit -m 'i am not mentioning a bug id'
36 hg commit -m 'i refer you to bug 666'