hgbook

diff es/examples/hook.ws @ 479:5236357a00b2

finished hook.tex
author Javier Rojas <jerojasro@devnull.li>
date Sun Jan 04 21:51:51 2009 -0500 (2009-01-04)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/es/examples/hook.ws	Sun Jan 04 21:51:51 2009 -0500
     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