hgbook

view en/examples/hook.simple @ 34:c0979ed1eabd

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