hgbook

annotate fr/examples/ch09/hook.ws @ 1114:527b86d55d4a

inotify: update installation information

inotify is shipped in Mercurial since 1.0, which greatly simplifies the installation process
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sun Dec 13 16:35:56 2009 +0900 (2009-12-13)
parents
children
rev   line source
belaran@966 1 #!/bin/bash
belaran@966 2
belaran@966 3 hg init a
belaran@966 4 cd a
belaran@966 5 echo '[hooks]' > .hg/hgrc
belaran@966 6 echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc
belaran@966 7
belaran@966 8 #$ name: simple
belaran@966 9
belaran@966 10 cat .hg/hgrc
belaran@966 11 echo 'a ' > a
belaran@966 12 hg commit -A -m 'test with trailing whitespace'
belaran@966 13 echo 'a' > a
belaran@966 14 hg commit -A -m 'drop trailing whitespace and try again'
belaran@966 15
belaran@966 16 #$ name:
belaran@966 17
belaran@966 18 echo '[hooks]' > .hg/hgrc
belaran@966 19 echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc
belaran@966 20 cp $EXAMPLE_DIR/ch09/check_whitespace.py.lst .hg/check_whitespace.py
belaran@966 21 chmod +x .hg/check_whitespace.py
belaran@966 22
belaran@966 23 #$ name: better
belaran@966 24
belaran@966 25 cat .hg/hgrc
belaran@966 26 echo 'a ' >> a
belaran@966 27 hg commit -A -m 'add new line with trailing whitespace'
belaran@966 28 sed -i 's, *$,,' a
belaran@966 29 hg commit -A -m 'trimmed trailing whitespace'
belaran@966 30
belaran@966 31 #$ name:
belaran@966 32 exit 0