hgbook
diff es/examples/hook.simple @ 771:f67a90f6c055
Deep revision of Ch.10.
author | Giulio@puck |
---|---|
date | Fri Jul 31 23:27:41 2009 +0200 (2009-07-31) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/es/examples/hook.simple Fri Jul 31 23:27:41 2009 +0200 1.3 @@ -0,0 +1,37 @@ 1.4 +#!/bin/bash 1.5 + 1.6 +#$ name: init 1.7 + 1.8 +hg init hook-test 1.9 +cd hook-test 1.10 +echo '[hooks]' >> .hg/hgrc 1.11 +echo 'commit = echo committed $HG_NODE' >> .hg/hgrc 1.12 +cat .hg/hgrc 1.13 +echo a > a 1.14 +hg add a 1.15 +hg commit -m 'testing commit hook' 1.16 + 1.17 +#$ name: ext 1.18 +#$ ignore: ^date of commit.* 1.19 + 1.20 +echo 'commit.when = echo -n "date of commit: "; date' >> .hg/hgrc 1.21 +echo a >> a 1.22 +hg commit -m 'i have two hooks' 1.23 + 1.24 +#$ name: 1.25 + 1.26 +echo '#!/bin/sh' >> check_bug_id 1.27 +echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id 1.28 +echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id 1.29 +chmod +x check_bug_id 1.30 + 1.31 +#$ name: pretxncommit 1.32 + 1.33 +cat check_bug_id 1.34 + 1.35 +echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc 1.36 + 1.37 +echo a >> a 1.38 +hg commit -m 'i am not mentioning a bug id' 1.39 + 1.40 +hg commit -m 'i refer you to bug 666'