diff options
author | michelou <michelou@epfl.ch> | 2011-09-17 09:06:25 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2011-09-17 09:06:25 +0000 |
commit | 3b48cc7fe0facd63224eacb5f7113213ffb7bfe3 (patch) | |
tree | f8a5578659146ded6ef51a095993cedc87acfbe5 | |
parent | bd2381d654fb6affcd414f6089468cf3ca2f780d (diff) | |
download | scala-3b48cc7fe0facd63224eacb5f7113213ffb7bfe3.tar.gz scala-3b48cc7fe0facd63224eacb5f7113213ffb7bfe3.tar.bz2 scala-3b48cc7fe0facd63224eacb5f7113213ffb7bfe3.zip |
Get svn revision on Windows
-rw-r--r-- | build.xml | 5 | ||||
-rwxr-xr-x | tools/get-scala-revision | 2 | ||||
-rw-r--r-- | tools/get-scala-revision.bat | 42 |
3 files changed, 46 insertions, 3 deletions
@@ -221,9 +221,10 @@ INITIALISATION <condition property="os.win"> <os family="windows"/> </condition> - + <exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="svn.number" failifexecutionfails="false" /> - <!-- some default in case something went wrong getting the revision --> + <exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="svn.number" failifexecutionfails="false" /> + <!-- some default in case something went wrong getting the revision --> <property name="svn.number" value="0"/> <property name="init.avail" value="yes"/> diff --git a/tools/get-scala-revision b/tools/get-scala-revision index 4d6e67f79e..8731705d06 100755 --- a/tools/get-scala-revision +++ b/tools/get-scala-revision @@ -1,6 +1,6 @@ #!/bin/sh # -# Usage: get-scala-rev [dir] +# Usage: get-scala-revision [dir] # Figures out current scala revision of an svn checkout or # a git-svn mirror (or a git clone.) # diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat new file mode 100644 index 0000000000..c9de414cea --- /dev/null +++ b/tools/get-scala-revision.bat @@ -0,0 +1,42 @@ +@echo off +rem +rem Usage: get-scala-revison.bat [dir] +rem Figures out current scala revision of an svn checkout or +rem a git-svn mirror (or a git clone.) +rem +rem If no dir is given, current working dir is used. + +if "%OS%" NEQ "Windows_NT" ( + echo "Sorry, your version of Windows is too old to run Scala." + goto :eof +) +@setlocal + +set _DIR= +if "%*"=="" ( + for /f %%i in ('cd') do set _DIR=%%i +) else ( + set _DIR=%~1 +) +cd %_DIR% + +if exist .svn\NUL ( + rem 2>&1 to catch also error output (e.g. svn warnings) + for /f "skip=4 tokens=2" %%i in ('svn info') do ( + echo %%i + goto :end + ) +) else ( if exist .git\NUL ( + set _GIT_PAGER=type + rem this grabs more than one line because otherwise if you have local + rem commits which aren't in git-svn it won't see any revision. + rem TODO: git log -10 | findstr git-svn-id | ... + echo 0 +) else ( + echo %_DIR% doesn't appear to be git or svn dir. + echo 0 + exit 1 +)) + +:end +@endlocal |