svnrevision.sh now better; first looks for svn info, then git-svn, then gives up...
[bachelor-thesis/roomba_tests.git] / svnrevision.sh
1 #!/bin/bash
2
3 # try SVN
4 revision=$(svn info 2>&1|grep Revision|sed 's/Revision: //')
5 stat=$(svn status 2>&1|grep '^M')
6
7 # if that fails, try git-svn
8 if [ -z "$revision" ]; then
9 revision=$(git svn info 2>&1|grep Revision|sed 's/Revision: //')
10 stat=$(git status 2>&1|grep 'modified: ');
11 fi;
12
13 # if that fails, give up
14 if [ -z "$revision" ]; then
15 $revision="No SVN or git-svn working copy!"
16 else
17 if [ -n "$stat" ]; then
18 status=" with local changes"
19 else
20 status=""
21 fi;
22 fi;
23
24 echo '// This file is created automatically, your changes will be lost.' > svnrevision.h
25 echo '#define SVNREVISION "r'$revision$status'"' >> svnrevision.h
26
This page took 0.066281 seconds and 5 git commands to generate.