hgbook
annotate en/examples/ch09/hook.ws @ 1023:407206673eec
French: better translation in ch04
author | André Sintzoff <andre.sintzoff@gmail.com> |
---|---|
date | Wed Dec 02 18:33:34 2009 +0100 (2009-12-02) |
parents | e67251ac336f |
children |
rev | line source |
---|---|
bos@47 | 1 #!/bin/bash |
bos@47 | 2 |
bos@44 | 3 hg init a |
bos@44 | 4 cd a |
bos@44 | 5 echo '[hooks]' > .hg/hgrc |
bos@167 | 6 echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc |
bos@44 | 7 |
bos@44 | 8 #$ name: simple |
bos@44 | 9 |
bos@44 | 10 cat .hg/hgrc |
bos@44 | 11 echo 'a ' > a |
bos@44 | 12 hg commit -A -m 'test with trailing whitespace' |
bos@49 | 13 echo 'a' > a |
bos@49 | 14 hg commit -A -m 'drop trailing whitespace and try again' |
bos@49 | 15 |
bos@49 | 16 #$ name: |
bos@49 | 17 |
bos@49 | 18 echo '[hooks]' > .hg/hgrc |
bos@150 | 19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc |
bos@694 | 20 cp $EXAMPLE_DIR/ch09/check_whitespace.py.lst .hg/check_whitespace.py |
bos@694 | 21 chmod +x .hg/check_whitespace.py |
bos@49 | 22 |
bos@49 | 23 #$ name: better |
bos@49 | 24 |
bos@49 | 25 cat .hg/hgrc |
bos@49 | 26 echo 'a ' >> a |
bos@49 | 27 hg commit -A -m 'add new line with trailing whitespace' |
bos@165 | 28 sed -i 's, *$,,' a |
bos@49 | 29 hg commit -A -m 'trimmed trailing whitespace' |
bos@74 | 30 |
bos@74 | 31 #$ name: |
bos@74 | 32 exit 0 |