hgbook
diff 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 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/es/examples/hook.ws Sat Aug 15 15:15:39 2009 +0200 1.3 @@ -0,0 +1,31 @@ 1.4 +#!/bin/bash 1.5 + 1.6 +hg init a 1.7 +cd a 1.8 +echo '[hooks]' > .hg/hgrc 1.9 +echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc 1.10 + 1.11 +#$ name: simple 1.12 + 1.13 +cat .hg/hgrc 1.14 +echo 'a ' > a 1.15 +hg commit -A -m 'test with trailing whitespace' 1.16 +echo 'a' > a 1.17 +hg commit -A -m 'drop trailing whitespace and try again' 1.18 + 1.19 +#$ name: 1.20 + 1.21 +echo '[hooks]' > .hg/hgrc 1.22 +echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc 1.23 +cp $EXAMPLE_DIR/data/check_whitespace.py .hg 1.24 + 1.25 +#$ name: better 1.26 + 1.27 +cat .hg/hgrc 1.28 +echo 'a ' >> a 1.29 +hg commit -A -m 'add new line with trailing whitespace' 1.30 +sed -i 's, *$,,' a 1.31 +hg commit -A -m 'trimmed trailing whitespace' 1.32 + 1.33 +#$ name: 1.34 +exit 0