Mercurial > hgbook
annotate en/examples/hook.ws @ 804:83540574ee49
removed whitespace from URLs
author | Raphael Borun Das Gupta <hg@raphael.dasgupta.ch> |
---|---|
date | Sat, 18 Apr 2009 17:38:07 +0200 |
parents | e67251ac336f |
children |
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 |
167
e67251ac336f
Small portability change. "grep -P" doesn't work on Debian.
Bryan O'Sullivan <bos@serpentine.com>
parents:
165
diff
changeset
|
6 echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc |
44
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' | |
165
06d18465df03
Make an example run more predictably.
Bryan O'Sullivan <bos@serpentine.com>
parents:
150
diff
changeset
|
27 sed -i 's, *$,,' a |
49 | 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 |