svnrevision.sh now better; first looks for svn info, then git-svn, then gives up...
authorsvnhieber <svnhieber@f8795833-4959-0410-8ae9-8bcb0cfab428>
Tue, 18 Jan 2011 18:19:01 +0000 (18:19 +0000)
committersvnhieber <svnhieber@f8795833-4959-0410-8ae9-8bcb0cfab428>
Tue, 18 Jan 2011 18:19:01 +0000 (18:19 +0000)
git-svn-id: https://svn.itm.uni-luebeck.de/wisebed/wiselib/trunk/pc_apps/roomba_tests@4090 f8795833-4959-0410-8ae9-8bcb0cfab428

svnrevision.sh

index 072d714..c90f410 100755 (executable)
@@ -1,19 +1,24 @@
 #!/bin/bash
 #!/bin/bash
-if [ -d .svn ]; then
-  revision=$(svn info|grep Revision|sed 's/Revision: //')
-  stat=$(svn status|grep '^M')
-elif [ -d .git/svn ]; then
-  revision=$(git svn info|grep Revision|sed 's/Revision: //')
-  stat=$(git status|grep 'modified: ')
-else
-  echo No SVN working copy!
-  exit 1;
+
+# try SVN
+revision=$(svn info 2>&1|grep Revision|sed 's/Revision: //')
+stat=$(svn status 2>&1|grep '^M')
+
+# 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;
 
 fi;
 
-if [ -n "$stat" ]; then
-  status=" with local changes"
+# if that fails, give up
+if [ -z "$revision" ]; then
+  $revision="No SVN or git-svn working copy!"
 else
 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
 fi;
 
 echo '// This file is created automatically, your changes will be lost.' > svnrevision.h
This page took 0.022948 seconds and 4 git commands to generate.