Last active
March 1, 2016 11:18
-
-
Save yonglam/2478fd21fccf7764f1d7 to your computer and use it in GitHub Desktop.
Check some restrictive condition befor commit to svn server
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 | |
# Check test code | |
v=$(svn diff | grep -i -e '^\+.*paul' -e '^\+.*//.*@test' -e '^\+.*/\*.*@test' -e '^\+.*DevelopmentTeam\s*=\s*') | |
if [ "x$v" != "x" ] | |
then | |
echo "\033[31m Commit Failed! *** Reason: Test codes are added! *** \033[0m" | |
echo "$v" | |
exit | |
fi | |
# Check .m file | |
v=$(svn diff | grep -i -e '^\+.*/\*.*\.m\b') | |
if [ "x$v" != "x" ] | |
then | |
echo "\033[31m Commit Failed! *** Reason: .m files are added! *** \033[0m" | |
echo "$v" | |
exit | |
fi | |
# Commit | |
echo "\033[36m Pre-commit checked OK. Start commit... \033[0m" | |
svn ci "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment