hgbook

view en/examples/hook.simple @ 36:5cee64874312

Require examples to be executable, so it's easier to see them with "ls".
author Bryan O'Sullivan <bos@serpentine.com>
date Mon Jul 17 00:00:12 2006 -0700 (2006-07-17)
parents c0979ed1eabd
children 6f37e6a7d8cd
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'