One operation I require in order to write sane autobuild scripts is something akin to svnversion. I need it to work for me, in my git svn-cloned repo, and for the mortals in other offices using plain ol' svn.
Took me a while, and here's what I came up with.
#!/bin/bash# Returns the svn version number of the current directory.# Works in an svn working copy, or in a git svn clone of an svn repo.get_svnversion(){alias git_svnversion="git svn find-rev `git log -1 --pretty=format:%H 2>/dev/null` 2>/dev/null"SVNVERSION=`svnversion`
if [ "X$SVNVERSION" == "Xexported" -o "X$SVNVERSION" == "X" ]; then
git_svnversion
else
echo $SVNVERSIONfi}echo $(get_svnversion)
Of course, there are some unpleasant dependencies on the particular version of svnversion you have installed and it's output on a non-svn tree. You could probably make this a little more bullet-proof if required.
Oh, and before you ask: blogger ate my formatting.