X-Git-Url: http://git.rohieb.name/bachelor-thesis/roomba_tests.git/blobdiff_plain/f6be7e61cd8ee3cfadf1d83c48a1b5b8d1628c0d..d4fa43e14924805250c6e07edd401f45953d3c84:/svnrevision.sh?ds=sidebyside diff --git a/svnrevision.sh b/svnrevision.sh index 67b03a2..c90f410 100755 --- a/svnrevision.sh +++ b/svnrevision.sh @@ -1,11 +1,24 @@ #!/bin/bash -revision=$(svn info|grep Revision|sed 's/Revision: //') +# try SVN +revision=$(svn info 2>&1|grep Revision|sed 's/Revision: //') +stat=$(svn status 2>&1|grep '^M') -if [ -n "$(svn status|grep '^M')" ]; then - status=" with local changes" +# if that fails, try git-svn +if [ -z "$revision" ]; then + revision=$(git svn info 2>&1|grep Revision|sed 's/Revision: //') + stat=$(git status 2>&1|grep 'modified: '); +fi; + +# if that fails, give up +if [ -z "$revision" ]; then + $revision="No SVN or git-svn working copy!" else - status="" + if [ -n "$stat" ]; then + status=" with local changes" + else + status="" + fi; fi; echo '// This file is created automatically, your changes will be lost.' > svnrevision.h