diff en/examples/hook.ws @ 49:18210d46491f

More hook content.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 25 Jul 2006 00:18:31 -0700
parents 6f37e6a7d8cd
children ec1f144968de
line wrap: on
line diff
--- a/en/examples/hook.ws	Mon Jul 24 15:58:33 2006 -0400
+++ b/en/examples/hook.ws	Tue Jul 25 00:18:31 2006 -0700
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-cp $EXAMPLE_DIR/data/check_whitespace.py .
-
 hg init a
 cd a
 echo '[hooks]' > .hg/hgrc
@@ -12,3 +10,19 @@
 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'