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