On Thu, Jan 15 09 at  3:43:44PM +0000, Alex Bennee wrote:
> Ok I'll tweak it to that format. I still think having dirty adds
> useful information. It may be worth just dumping that into
> rockbox-info.txt
> 
> Can you post your copy of the script and I'll slurb the bzr bit into
> it of you want.

Patch attached. Unfortunately it takes about 8 seconds to run the bzr version
on my machine, because there is no way at present to extract the bzr-svn
version info as a single operation: the script I have just greps the entire bzr
log for it. bzr-svn supports merging revisions from more than one svn
repository/branch into a single bzr branch, so I don't know that there is a
better way particularly :) It won't run unless there is a .bzr directory in
your tree so it shouldn't matter for anyone else.

One other thing this doesn't take into account is the possibility that the
branch is a direct checkout of svn with no local changes at all: it still
includes the bzr revision number in that case. Again, writing a generic script
that can detect this is more fiddly than I'd like.

-- 
Torne Wuff
[email protected]
=== modified file 'tools/svnversion.sh'
--- tools/svnversion.sh 2008-11-04 03:05:46 +0000
+++ tools/svnversion.sh 2009-01-19 16:27:16 +0000
@@ -20,8 +20,10 @@
             # Not a SVN repository, maybe a git-svn one ?
             if [ -z "$1" ]; then
                 GITDIR="./.git"
+                BZRDIR="./.bzr"
             else
                 GITDIR="$1/.git"
+                BZRDIR="$1/.bzr"
             fi

             # First make sure it is a git repository
@@ -32,7 +34,14 @@
                 else
                     echo "r$OUTPUT"
                 fi
-            else # not a git repository
+            elif [ -d "$BZRDIR" ]; then
+                OUTPUT=`LANG=C bzr log "$@" 2>/dev/null|grep '^svn revno: '|head -n1|cut -d\  -f3`
+                if [ -z "$OUTPUT" ]; then
+                    echo "unknown"
+                else
+                    echo "r$OUTPUT+bzr`bzr revno "$@"`"
+                fi
+            else # not a git/bzr repository
                 echo "unknown"
             fi
         else


Reply via email to