annotate ja/examples/hook.ws @ 779:69923723e7f9

more hook.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 27 Apr 2009 17:31:54 +0900
parents b0db5adf11c1
children
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
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
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'
165
06d18465df03 Make an example run more predictably.
Bryan O'Sullivan <bos@serpentine.com>
parents: 150
diff changeset
27 sed -i 's, *$,,' a
49
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