view en/examples/hook.ws @ 74:ec1f144968de

Fix a few examples now that run-examples is more stringent.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 30 Aug 2006 00:02:02 -0700
parents 18210d46491f
children 8cf40d4d9377
line wrap: on
line source

#!/bin/bash

hg init a
cd a
echo '[hooks]' > .hg/hgrc
echo "pretxncommit.whitespace = hg export tip | (! grep -qP '^\\+.*[ \\t]$')" >> .hg/hgrc

#$ name: simple

cat .hg/hgrc
echo 'a ' > a
hg commit -A -m 'test with trailing whitespace'
echo 'a' > a
hg commit -A -m 'drop trailing whitespace and try again'

#$ name:

echo '[hooks]' > .hg/hgrc
echo "pretxncommit.whitespace = check_whitespace.py" >> .hg/hgrc
cp $EXAMPLE_DIR/data/check_whitespace.py .

#$ name: better

cat .hg/hgrc
echo 'a ' >> a
hg commit -A -m 'add new line with trailing whitespace'
perl -pi -e 's,\s+$,,' a
hg commit -A -m 'trimmed trailing whitespace'

#$ name:
exit 0