Created
June 27, 2012 00:48
-
-
Save cointoss1973/3000512 to your computer and use it in GitHub Desktop.
Mercurial pretxnchagegroup hook test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# Windows batch command | |
# - tested on msysgit on Windows | |
export LANGUAGE=C | |
hg version -q | |
reporoot=temp #temp directory | |
centrepo=$reporoot/centrepo | |
workrepo=$reporoot/multi | |
HGPORT1=8001 | |
rm -fr $reporoot | |
hg init $centrepo | |
touch $centrepo/CENTREPO | |
hg -R $centrepo ci -Am "add CENTREPO" | |
cat > $reporoot/hgweb.conf <<EOF | |
[web] | |
allow_push=* | |
push_ssl=False | |
[paths] | |
EOF | |
echo $centrepo=$centrepo >> $reporoot/hgweb.conf | |
cat $reporoot/hgweb.conf | |
hg serve -R $centrepo -d -p $HGPORT1 --web-conf $reporoot/hgweb.conf -E $reporoot/Error.log | |
#hg clone $centrepo $workrepo | |
hg clone http://localhost:$HGPORT1/$centrepo $workrepo | |
# working repo | |
touch $workrepo/foo | |
hg -R $workrepo ci -Am "add foo" | |
# push abort test1 | |
cat > $centrepo/.hg/hgrc <<EOF | |
[hooks] | |
pretxnchangegroup.abort = exit /b 1 | |
EOF | |
if hg -R $workrepo push; then | |
echo "NG" # push success | |
exit 1 | |
fi | |
echo "OK" # push aborted | |
# push abort test1 | |
cat > $centrepo/.hg/hgrc <<EOF | |
[hooks] | |
pretxnchangegroup.abort = exit 1 | |
EOF | |
if hg -R $workrepo push; then | |
echo "NG" # push success | |
exit 1 | |
fi | |
echo "OK" # push aborted | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment