hgbook
annotate en/examples/hook.simple @ 80:ea951cfb5cd9
Much template-related content.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed Sep 06 23:36:47 2006 -0700 (2006-09-06) |
parents | 5cee64874312 |
children | ceaca14e49f0 |
rev | line source |
---|---|
bos@47 | 1 #!/bin/bash |
bos@47 | 2 |
bos@34 | 3 #$ name: init |
bos@34 | 4 |
bos@34 | 5 hg init hook-test |
bos@34 | 6 cd hook-test |
bos@34 | 7 echo '[hooks]' >> .hg/hgrc |
bos@34 | 8 echo 'commit = echo committed $HG_NODE' >> .hg/hgrc |
bos@34 | 9 cat .hg/hgrc |
bos@34 | 10 echo a > a |
bos@34 | 11 hg add a |
bos@34 | 12 hg commit -m 'testing commit hook' |
bos@34 | 13 |
bos@34 | 14 #$ name: ext |
bos@34 | 15 |
bos@34 | 16 echo 'commit.when = echo "date of commit:"; date' >> .hg/hgrc |
bos@34 | 17 echo a >> a |
bos@34 | 18 hg commit -m 'i have two hooks' |
bos@34 | 19 |
bos@34 | 20 #$ name: |
bos@34 | 21 |
bos@34 | 22 echo '#!/bin/sh' >> check_bug_id |
bos@34 | 23 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id |
bos@34 | 24 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id |
bos@34 | 25 chmod +x check_bug_id |
bos@34 | 26 |
bos@34 | 27 #$ name: pretxncommit |
bos@34 | 28 |
bos@34 | 29 cat check_bug_id |
bos@34 | 30 |
bos@34 | 31 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc |
bos@34 | 32 |
bos@34 | 33 echo a >> a |
bos@34 | 34 hg commit -m 'i am not mentioning a bug id' |
bos@34 | 35 |
bos@34 | 36 hg commit -m 'i refer you to bug 666' |