view en/examples/hook.simple @ 45:6b7b0339e7d6

Don't rerun examples unnecessarily.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 23 Jul 2006 23:34:24 -0700
parents 5cee64874312
children 6f37e6a7d8cd
line wrap: on
line source

#$ name: init

hg init hook-test
cd hook-test
echo '[hooks]' >> .hg/hgrc
echo 'commit = echo committed $HG_NODE' >> .hg/hgrc
cat .hg/hgrc
echo a > a
hg add a
hg commit -m 'testing commit hook'

#$ name: ext

echo 'commit.when = echo "date of commit:"; date' >> .hg/hgrc
echo a >> a
hg commit -m 'i have two hooks'

#$ name:

echo '#!/bin/sh' >> check_bug_id
echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id
echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id
chmod +x check_bug_id

#$ name: pretxncommit

cat check_bug_id

echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc

echo a >> a
hg commit -m 'i am not mentioning a bug id'

hg commit -m 'i refer you to bug 666'