Created
April 22, 2011 21:21
-
-
Save hpbuniat/937714 to your computer and use it in GitHub Desktop.
Debugging with SVN and PHPUnit (port of http://sebastian-bergmann.de/archives/911-Debugging-with-Git-and-PHPUnit.html#content)
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/bash | |
svncolor='{a["A"]=32;a["U"]=34;a["C"]=31;a["M"]=34;a["G"]=37;a["?"]=33;a["D"]=36;printf("\033[1;%sm%s\033[0;00m\n",a[$1],$0)}'; | |
revision=`svn info ../ --non-interactive | grep Revision | awk '{print $2}'` | |
prev=$revision | |
next=$revision | |
echo -e "\e[32m!!!\e[m current revision is: \e[32m$revision\e[m" | |
while true; do | |
revision=`svn info ../ --non-interactive | grep Revision | awk '{print $2}'` | |
echo -e "\e[32m!!!\e[m testing $@ with rev \e[32m$revision\e[m"; | |
phpunit $@ > /dev/null | |
if [ $? == 0 ] | |
then | |
if [ $revision == $next -a $revision == $prev ]; then | |
echo -e "\e[32m!!!\e[m everything seems to be \e[32mfine\e[m, .. aborting!"; | |
else | |
echo -e "\e[32m!!!\e[m rev \e[32m$revision\e[m looks good, so rev \e[31m$prev\e[m was buggy!"; | |
next=$prev; | |
fi | |
else | |
prev=$revision; | |
next='PREV'; | |
echo -e "\e[31m!!!\e[m test is failing with rev \e[31m$revision\e[m, updating to \e[33m$next\e[m!"; | |
fi | |
echo -e "\e[33m!!!\e[m performing svn update -r \e[33m$next\e[m"; | |
svn update ../ --revision $next --force --non-interactive | awk $svncolor; | |
if [ $next == $prev ]; then | |
echo -e "\e[32m!!!\e[m bug-search finish at rev \e[31m$prev\e[m!"; | |
svn log ../ -r $prev -v; | |
break; | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment