igor@333: #!/bin/bash igor@333: igor@333: hg init a igor@333: cd a igor@333: echo '[hooks]' > .hg/hgrc igor@333: echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc igor@333: igor@333: #$ name: simple igor@333: igor@333: cat .hg/hgrc igor@333: echo 'a ' > a igor@333: hg commit -A -m 'test with trailing whitespace' igor@333: echo 'a' > a igor@333: hg commit -A -m 'drop trailing whitespace and try again' igor@333: igor@333: #$ name: igor@333: igor@333: echo '[hooks]' > .hg/hgrc igor@333: echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc igor@333: cp $EXAMPLE_DIR/data/check_whitespace.py .hg igor@333: igor@333: #$ name: better igor@333: igor@333: cat .hg/hgrc igor@333: echo 'a ' >> a igor@333: hg commit -A -m 'add new line with trailing whitespace' igor@333: sed -i 's, *$,,' a igor@333: hg commit -A -m 'trimmed trailing whitespace' igor@333: igor@333: #$ name: igor@333: exit 0