c90f41000622f143885246f179c72cd948437cbc
[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.039782 seconds and 3 git commands to generate.