Comment Comment by EGreg This is cool but why do we need it if Mercurial already supports pre-commit hooks?For example we have this for refreshing redmine: #!/bin/sh PROJ="" while [ $# -gt 0 ] ; do case $1 in --project) shift PROJ="&id=$1" shift ;; esac done echo $"Refreshing Redmine" curl -s -o /dev/null "http://issues.qbixstaging.com/sys/fetch_changesets?key=jI$ and here is our PHP syntax check: #!/bin/sh ### Configuration HGBIN="/usr/bin/hg" phpPath="/usr/bin/php" tmpstyle=`/bin/mktemp -t` ### hg log style file cat > $tmpstyle << EOF changeset = "{files}\n" file = "{file}\n" EOF ### PHP syntax check for f in `$HGBIN log -r $HG_NODE:tip --style $tmpstyle | grep -E "\.php[3-5]?$" | sort | uniq` ; do res=`$HGBIN cat -r tip $f | $phpPath -l -d display_errors=1 -d error_reporting=4` if [ $? -ne 0 ] ; then echo $f 1>&2 echo $res 1>&2 exit 1 fi done rm $tmpstyle finally here is one for JS: #!/bin/sh ### Configuration HGBIN="/usr/bin/hg" jshPath="/usr/local/bin/jshint" tmpstyle=`/bin/mktemp -t` ### hg log style file cat > $tmpstyle << EOF changeset = "{files}\n" file = "{file}\n" EOF ### JS syntax check for f in `$HGBIN log -r $HG_NODE:tip --style $tmpstyle | grep -E "\.js$" | sort | uniq` ; do res=`$HGBIN cat -r tip $f | $jshPath --config /projects/.jshintrc --verbose - | grep "(E"` st=$? if [ $st -eq 0 ] ; then echo $f 1>&2 echo $res 1>&2 exit 1 fi if [ $st -gt 1 ] ; then exit 1 fi done rm $tmpstyle parent EGreg 12 years ago
For example we have this for refreshing redmine:
and here is our PHP syntax check: finally here is one for JS: