blob: 77e1fcaf5e9965dd3d7af8d682d50ac84a8fcf0a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/sh
# Gets the version number from VCS, or from the contents of the file $1
version=
if test -f "$1"
then
version=$(cat $1)
fi
if test "x$version" = "x" -a -d "./.git"
then
version=$(git svn info | grep "Revision: [[:digit:]]\+" | sed -e 's/Revision: //')
if test "x$version" = "x"
then
version=$(git log -1 | grep 'commit [a-f0-9]\+' | sed -e 's/commit //')
if test ! "x$version" = "x"
then
version="git-$version"
fi
else
version="r$version"
fi
fi
if test "x$version" = "x" -a -d "./.svn"
then
version=$(svn info | grep "Revision: [[:digit:]]\+" | sed -e 's/Revision: //')
if test ! "x$version" = "x"
then
version="r$version"
fi
fi
if test "x$version" = "x"
then
version="unknown"
fi
echo $version
|