diff options
-rwxr-xr-x | tools/version.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/version.sh b/tools/version.sh index 25e781c784..2e75004901 100755 --- a/tools/version.sh +++ b/tools/version.sh | |||
@@ -61,6 +61,30 @@ gitversion() { | |||
61 | fi | 61 | fi |
62 | } | 62 | } |
63 | 63 | ||
64 | # Work out the latest svn id and also the latest bzr revno | ||
65 | bzrversion() { | ||
66 | |||
67 | # look for a svn revno in the current head | ||
68 | svnver=`LANG=C bzr log -l1 $1 | grep '^ *svn revno: ' | cut -d : -f2 | cut -d ' ' -f 2` | ||
69 | |||
70 | if [ -n "$svnver" ]; then | ||
71 | # current head is a svn version so we don't care about bzr | ||
72 | version="r$svnver" | ||
73 | else | ||
74 | # look for a svn revno anywhere in history including in merges | ||
75 | svnver=`LANG=C bzr log -n0 $1 | grep '^ *svn revno: ' | head -n 1 | cut -d : -f2 | cut -d ' ' -f 2` | ||
76 | if [ -n "$svnver" ]; then | ||
77 | version="r$svnver+bzr`bzr revno $1`" | ||
78 | else | ||
79 | version="bzr`bzr revno $1`" | ||
80 | fi | ||
81 | fi | ||
82 | if ! bzr diff $1 >/dev/null; then | ||
83 | mod="M" | ||
84 | fi | ||
85 | echo "${version}${mod}" | ||
86 | } | ||
87 | |||
64 | # | 88 | # |
65 | # First locate the top of the src tree (passed in usually) | 89 | # First locate the top of the src tree (passed in usually) |
66 | # | 90 | # |
@@ -73,6 +97,8 @@ else | |||
73 | # Ok, we need to derive it from the Version Control system | 97 | # Ok, we need to derive it from the Version Control system |
74 | if [ -d "$TOP/.git" ]; then | 98 | if [ -d "$TOP/.git" ]; then |
75 | VER=`gitversion $TOP` | 99 | VER=`gitversion $TOP` |
100 | elif [ -d "$TOP/.bzr" ]; then | ||
101 | VER=`bzrversion $TOP` | ||
76 | else | 102 | else |
77 | VER=`svnversion_safe $TOP`; | 103 | VER=`svnversion_safe $TOP`; |
78 | if [ "$VER" = "unknown" ]; then | 104 | if [ "$VER" = "unknown" ]; then |