annotate es/examples/hook.ws @ 500:3e78daaad99b

Finished undo chapter
author Igor TAmara <igor@tamarapatino.org>
date Fri, 07 Nov 2008 21:33:22 -0500
parents 04c08ad7e92e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
432
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
1 #!/bin/bash
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
2
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
3 hg init a
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
4 cd a
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
5 echo '[hooks]' > .hg/hgrc
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
6 echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
7
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
8 #$ name: simple
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
9
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
10 cat .hg/hgrc
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
11 echo 'a ' > a
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
12 hg commit -A -m 'test with trailing whitespace'
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
13 echo 'a' > a
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
14 hg commit -A -m 'drop trailing whitespace and try again'
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
15
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
16 #$ name:
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
17
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
18 echo '[hooks]' > .hg/hgrc
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
20 cp $EXAMPLE_DIR/data/check_whitespace.py .hg
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
21
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
22 #$ name: better
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
23
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
24 cat .hg/hgrc
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
25 echo 'a ' >> a
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
26 hg commit -A -m 'add new line with trailing whitespace'
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
27 sed -i 's, *$,,' a
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
28 hg commit -A -m 'trimmed trailing whitespace'
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
29
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
30 #$ name:
04c08ad7e92e Translated svgs dummy .tex towards building
Igor TAmara <igor@tamarapatino.org>
parents:
diff changeset
31 exit 0