annotate en/examples/hook.ws @ 150:8cf40d4d9377

Fix broken example.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 08 Mar 2007 23:11:55 -0800
parents ec1f144968de
children 06d18465df03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47
6f37e6a7d8cd Get Emacs to figure out what syntax highlighting to use for examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
1 #!/bin/bash
6f37e6a7d8cd Get Emacs to figure out what syntax highlighting to use for examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
2
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 hg init a
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 cd a
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 echo '[hooks]' > .hg/hgrc
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6 echo "pretxncommit.whitespace = hg export tip | (! grep -qP '^\\+.*[ \\t]$')" >> .hg/hgrc
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 #$ name: simple
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 cat .hg/hgrc
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 echo 'a ' > a
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 hg commit -A -m 'test with trailing whitespace'
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
13 echo 'a' > a
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
14 hg commit -A -m 'drop trailing whitespace and try again'
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
15
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
16 #$ name:
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
17
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
18 echo '[hooks]' > .hg/hgrc
150
8cf40d4d9377 Fix broken example.
Bryan O'Sullivan <bos@serpentine.com>
parents: 74
diff changeset
19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc
8cf40d4d9377 Fix broken example.
Bryan O'Sullivan <bos@serpentine.com>
parents: 74
diff changeset
20 cp $EXAMPLE_DIR/data/check_whitespace.py .hg
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
21
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
22 #$ name: better
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
23
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
24 cat .hg/hgrc
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
25 echo 'a ' >> a
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
26 hg commit -A -m 'add new line with trailing whitespace'
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
27 perl -pi -e 's,\s+$,,' a
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 47
diff changeset
28 hg commit -A -m 'trimmed trailing whitespace'
74
ec1f144968de Fix a few examples now that run-examples is more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents: 49
diff changeset
29
ec1f144968de Fix a few examples now that run-examples is more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents: 49
diff changeset
30 #$ name:
ec1f144968de Fix a few examples now that run-examples is more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents: 49
diff changeset
31 exit 0