bos@47: #!/bin/bash
bos@47: 
bos@44: hg init a
bos@44: cd a
bos@44: echo '[hooks]' > .hg/hgrc
bos@44: echo "pretxncommit.whitespace = hg export tip | (! grep -qP '^\\+.*[ \\t]$')" >> .hg/hgrc
bos@44: 
bos@44: #$ name: simple
bos@44: 
bos@44: cat .hg/hgrc
bos@44: echo 'a ' > a
bos@44: hg commit -A -m 'test with trailing whitespace'
bos@49: echo 'a' > a
bos@49: hg commit -A -m 'drop trailing whitespace and try again'
bos@49: 
bos@49: #$ name:
bos@49: 
bos@49: echo '[hooks]' > .hg/hgrc
bos@49: echo "pretxncommit.whitespace = check_whitespace.py" >> .hg/hgrc
bos@49: cp $EXAMPLE_DIR/data/check_whitespace.py .
bos@49: 
bos@49: #$ name: better
bos@49: 
bos@49: cat .hg/hgrc
bos@49: echo 'a ' >> a
bos@49: hg commit -A -m 'add new line with trailing whitespace'
bos@49: perl -pi -e 's,\s+$,,' a
bos@49: hg commit -A -m 'trimmed trailing whitespace'