Mercurial > hgbook
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 |
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 | 13 echo 'a' > a |
14 hg commit -A -m 'drop trailing whitespace and try again' | |
15 | |
16 #$ name: | |
17 | |
18 echo '[hooks]' > .hg/hgrc | |
150 | 19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc |
20 cp $EXAMPLE_DIR/data/check_whitespace.py .hg | |
49 | 21 |
22 #$ name: better | |
23 | |
24 cat .hg/hgrc | |
25 echo 'a ' >> a | |
26 hg commit -A -m 'add new line with trailing whitespace' | |
27 perl -pi -e 's,\s+$,,' a | |
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 |