annotate en/examples/hook.simple @ 141:627effec9d4e

More attempts to tidy up regexps for ignoring.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 06 Mar 2007 21:36:14 -0800
parents ceaca14e49f0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47
6f37e6a7d8cd Get Emacs to figure out what syntax highlighting to use for examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 36
diff changeset
1 #!/bin/bash
6f37e6a7d8cd Get Emacs to figure out what syntax highlighting to use for examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 36
diff changeset
2
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 #$ name: init
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 hg init hook-test
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6 cd hook-test
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7 echo '[hooks]' >> .hg/hgrc
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 echo 'commit = echo committed $HG_NODE' >> .hg/hgrc
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 cat .hg/hgrc
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 echo a > a
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 hg add a
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 hg commit -m 'testing commit hook'
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 #$ name: ext
139
ceaca14e49f0 Add local regexps to ignore bits of output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
15 #$ ignore: ^date of commit.*
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16
139
ceaca14e49f0 Add local regexps to ignore bits of output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
17 echo 'commit.when = echo -n "date of commit: "; date' >> .hg/hgrc
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 echo a >> a
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 hg commit -m 'i have two hooks'
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 #$ name:
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 echo '#!/bin/sh' >> check_bug_id
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
24 echo '# check that a commit comment mentions a numeric bug id' >> check_bug_id
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 echo 'hg log -r $1 --template {desc} | grep -q "\<bug *[0-9]"' >> check_bug_id
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 chmod +x check_bug_id
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28 #$ name: pretxncommit
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30 cat check_bug_id
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32 echo 'pretxncommit.bug_id_required = ./check_bug_id $HG_NODE' >> .hg/hgrc
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
33
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 echo a >> a
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35 hg commit -m 'i am not mentioning a bug id'
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 hg commit -m 'i refer you to bug 666'