summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2009-10-15 12:38:24 +0000
committerTorne Wuff <torne@wolfpuppy.org.uk>2009-10-15 12:38:24 +0000
commit91933a3fef096d267b2aae1e32b7bff9fe4b3e02 (patch)
tree3c0d33d93799a3ec0cfc3a4ab35269f019fa0f01 /tools
parent3f66c2135803831685cb97913d4d32366c68ac18 (diff)
downloadrockbox-91933a3fef096d267b2aae1e32b7bff9fe4b3e02.tar.gz
rockbox-91933a3fef096d267b2aae1e32b7bff9fe4b3e02.tar.bz2
rockbox-91933a3fef096d267b2aae1e32b7bff9fe4b3e02.zip
Add support for detecting build version in a bzr checkout (for bzr-svn users).
From FS#10414 (by me) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23187 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/version.sh26
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() {
fi
}
+# Work out the latest svn id and also the latest bzr revno
+bzrversion() {
+
+ # look for a svn revno in the current head
+ svnver=`LANG=C bzr log -l1 $1 | grep '^ *svn revno: ' | cut -d : -f2 | cut -d ' ' -f 2`
+
+ if [ -n "$svnver" ]; then
+ # current head is a svn version so we don't care about bzr
+ version="r$svnver"
+ else
+ # look for a svn revno anywhere in history including in merges
+ svnver=`LANG=C bzr log -n0 $1 | grep '^ *svn revno: ' | head -n 1 | cut -d : -f2 | cut -d ' ' -f 2`
+ if [ -n "$svnver" ]; then
+ version="r$svnver+bzr`bzr revno $1`"
+ else
+ version="bzr`bzr revno $1`"
+ fi
+ fi
+ if ! bzr diff $1 >/dev/null; then
+ mod="M"
+ fi
+ echo "${version}${mod}"
+}
+
#
# First locate the top of the src tree (passed in usually)
#
@@ -73,6 +97,8 @@ else
# Ok, we need to derive it from the Version Control system
if [ -d "$TOP/.git" ]; then
VER=`gitversion $TOP`
+ elif [ -d "$TOP/.bzr" ]; then
+ VER=`bzrversion $TOP`
else
VER=`svnversion_safe $TOP`;
if [ "$VER" = "unknown" ]; then