hgbook

annotate ja/examples/hook.simple @ 859:84629ae2c99d

Adjust build system and web site structure.
author gpiancastelli
date Sun Aug 23 00:51:45 2009 +0200 (2009-08-23)
parents
children
rev   line source
foozy@708 1 #!/bin/bash
foozy@708 2
foozy@708 3 #$ name: init
foozy@708 4
foozy@708 5 hg init hook-test
foozy@708 6 cd hook-test
foozy@708 7 echo '[hooks]' >> .hg/hgrc
foozy@708 8 echo 'commit = echo committed $HG_NODE' >> .hg/hgrc
foozy@708 9 cat .hg/hgrc
foozy@708 10 echo a > a
foozy@708 11 hg add a
foozy@708 12 hg commit -m 'testing commit hook'
foozy@708 13
foozy@708 14 #$ name: ext
foozy@708 15 #$ ignore: ^date of commit.*
foozy@708 16
foozy@708 17 echo 'commit.when = echo -n "date of commit: "; date' >> .hg/hgrc
foozy@708 18 echo a >> a
foozy@708 19 hg commit -m 'i have two hooks'
foozy@708 20
foozy@708 21 #$ name:
foozy@708 22
foozy@708 23 echo '#!/bin/sh' >> check_bug_id
foozy@708 24 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id
foozy@708 25 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id
foozy@708 26 chmod +x check_bug_id
foozy@708 27
foozy@708 28 #$ name: pretxncommit
foozy@708 29
foozy@708 30 cat check_bug_id
foozy@708 31
foozy@708 32 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc
foozy@708 33
foozy@708 34 echo a >> a
foozy@708 35 hg commit -m 'i am not mentioning a bug id'
foozy@708 36
foozy@708 37 hg commit -m 'i refer you to bug 666'