hgbook
annotate 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 |
rev | line source |
---|---|
bos@47 | 1 #!/bin/bash |
bos@47 | 2 |
bos@34 | 3 #$ name: init |
bos@139 | 4 #$ ignore: [0-9a-f]{40} |
bos@34 | 5 |
bos@34 | 6 hg init hook-test |
bos@34 | 7 cd hook-test |
bos@34 | 8 echo '[hooks]' >> .hg/hgrc |
bos@34 | 9 echo 'commit = echo committed $HG_NODE' >> .hg/hgrc |
bos@34 | 10 cat .hg/hgrc |
bos@34 | 11 echo a > a |
bos@34 | 12 hg add a |
bos@34 | 13 hg commit -m 'testing commit hook' |
bos@34 | 14 |
bos@34 | 15 #$ name: ext |
bos@139 | 16 #$ ignore: ^date of commit.* |
bos@34 | 17 |
bos@139 | 18 echo 'commit.when = echo -n "date of commit: "; date' >> .hg/hgrc |
bos@34 | 19 echo a >> a |
bos@34 | 20 hg commit -m 'i have two hooks' |
bos@34 | 21 |
bos@34 | 22 #$ name: |
bos@34 | 23 |
bos@34 | 24 echo '#!/bin/sh' >> check_bug_id |
bos@34 | 25 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id |
bos@34 | 26 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id |
bos@34 | 27 chmod +x check_bug_id |
bos@34 | 28 |
bos@34 | 29 #$ name: pretxncommit |
bos@34 | 30 |
bos@34 | 31 cat check_bug_id |
bos@34 | 32 |
bos@34 | 33 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc |
bos@34 | 34 |
bos@34 | 35 echo a >> a |
bos@34 | 36 hg commit -m 'i am not mentioning a bug id' |
bos@34 | 37 |
bos@34 | 38 hg commit -m 'i refer you to bug 666' |