hgbook
annotate es/examples/hook.ws @ 812:42e2c9d47ef4
Minor changes and translation of code snippets for Ch.12.
author | Giulio@puck |
---|---|
date | Sat Aug 15 15:15:39 2009 +0200 (2009-08-15) |
parents | |
children |
rev | line source |
---|---|
igor@333 | 1 #!/bin/bash |
igor@333 | 2 |
igor@333 | 3 hg init a |
igor@333 | 4 cd a |
igor@333 | 5 echo '[hooks]' > .hg/hgrc |
igor@333 | 6 echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc |
igor@333 | 7 |
igor@333 | 8 #$ name: simple |
igor@333 | 9 |
igor@333 | 10 cat .hg/hgrc |
igor@333 | 11 echo 'a ' > a |
igor@333 | 12 hg commit -A -m 'test with trailing whitespace' |
igor@333 | 13 echo 'a' > a |
igor@333 | 14 hg commit -A -m 'drop trailing whitespace and try again' |
igor@333 | 15 |
igor@333 | 16 #$ name: |
igor@333 | 17 |
igor@333 | 18 echo '[hooks]' > .hg/hgrc |
igor@333 | 19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc |
igor@333 | 20 cp $EXAMPLE_DIR/data/check_whitespace.py .hg |
igor@333 | 21 |
igor@333 | 22 #$ name: better |
igor@333 | 23 |
igor@333 | 24 cat .hg/hgrc |
igor@333 | 25 echo 'a ' >> a |
igor@333 | 26 hg commit -A -m 'add new line with trailing whitespace' |
igor@333 | 27 sed -i 's, *$,,' a |
igor@333 | 28 hg commit -A -m 'trimmed trailing whitespace' |
igor@333 | 29 |
igor@333 | 30 #$ name: |
igor@333 | 31 exit 0 |