correct tick diff calculation for first iteration
[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 # ...and also check if there are un-dcommited changesets
12 stat=$stat$(git diff --stat HEAD git-svn);
13 fi;
14
15 # if that fails, give up
16 if [ -z "$revision" ]; then
17 $revision="No SVN or git-svn working copy!"
18 else
19 if [ -n "$stat" ]; then
20 status=" with local changes"
21 else
22 status=""
23 fi;
24 fi;
25
26 echo '// This file is created automatically, your changes will be lost.' > svnrevision.h
27 echo '#define SVNREVISION "r'$revision$status'"' >> svnrevision.h
28
This page took 0.046121 seconds and 5 git commands to generate.