hgbook
annotate en/examples/hook.simple @ 1023:407206673eec
French: better translation in ch04
author | André Sintzoff <andre.sintzoff@gmail.com> |
---|---|
date | Wed Dec 02 18:33:34 2009 +0100 (2009-12-02) |
parents | ceaca14e49f0 |
children |
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@139 | 15 #$ ignore: ^date of commit.* |
bos@34 | 16 |
bos@139 | 17 echo 'commit.when = echo -n "date of commit: "; date' >> .hg/hgrc |
bos@34 | 18 echo a >> a |
bos@34 | 19 hg commit -m 'i have two hooks' |
bos@34 | 20 |
bos@34 | 21 #$ name: |
bos@34 | 22 |
bos@34 | 23 echo '#!/bin/sh' >> check_bug_id |
bos@34 | 24 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id |
bos@34 | 25 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id |
bos@34 | 26 chmod +x check_bug_id |
bos@34 | 27 |
bos@34 | 28 #$ name: pretxncommit |
bos@34 | 29 |
bos@34 | 30 cat check_bug_id |
bos@34 | 31 |
bos@34 | 32 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc |
bos@34 | 33 |
bos@34 | 34 echo a >> a |
bos@34 | 35 hg commit -m 'i am not mentioning a bug id' |
bos@34 | 36 |
bos@34 | 37 hg commit -m 'i refer you to bug 666' |