hgbook

view en/examples/ch09/hook.ws @ 763:e4196f0a4701

Deep revision of Ch.8.
author Giulio@puck
date Wed Jul 22 18:56:58 2009 +0200 (2009-07-22)
parents e67251ac336f
children
line source
1 #!/bin/bash
3 hg init a
4 cd a
5 echo '[hooks]' > .hg/hgrc
6 echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc
8 #$ name: simple
10 cat .hg/hgrc
11 echo 'a ' > a
12 hg commit -A -m 'test with trailing whitespace'
13 echo 'a' > a
14 hg commit -A -m 'drop trailing whitespace and try again'
16 #$ name:
18 echo '[hooks]' > .hg/hgrc
19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc
20 cp $EXAMPLE_DIR/ch09/check_whitespace.py.lst .hg/check_whitespace.py
21 chmod +x .hg/check_whitespace.py
23 #$ name: better
25 cat .hg/hgrc
26 echo 'a ' >> a
27 hg commit -A -m 'add new line with trailing whitespace'
28 sed -i 's, *$,,' a
29 hg commit -A -m 'trimmed trailing whitespace'
31 #$ name:
32 exit 0