fix get-scala-revision script for the case when svn prints some warnings. no review
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24637 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
f70ea8bca0
commit
13d2835f42
|
@ -6,7 +6,7 @@ import sbt._
|
||||||
*/
|
*/
|
||||||
class SVN(root: Path) {
|
class SVN(root: Path) {
|
||||||
/** Location of tool which parses svn revision in git-svn repository. */
|
/** Location of tool which parses svn revision in git-svn repository. */
|
||||||
val GitSvnRevTool = root / "tools" / "get-git-svn-rev"
|
val GitSvnRevTool = root / "tools" / "get-scala-revision"
|
||||||
val GitSvnRegex = """^Revision:\s*(\d+).*""".r
|
val GitSvnRegex = """^Revision:\s*(\d+).*""".r
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Usage: get-scala-rev [dir]
|
|
||||||
# Figures out current scala revision of an svn checkout or
|
|
||||||
# a git-svn mirror (or a git clone.)
|
|
||||||
#
|
|
||||||
# If no dir is given, current working dir is used.
|
|
||||||
|
|
||||||
DIR=""
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
DIR=`pwd`
|
|
||||||
else
|
|
||||||
DIR=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $DIR
|
|
||||||
|
|
||||||
if [ -d .svn ]; then
|
|
||||||
svn info . | grep ^Revision | sed 's/Revision: //'
|
|
||||||
elif [ -d .git ]; then
|
|
||||||
GIT_PAGER=cat
|
|
||||||
# this grabs more than one line because otherwise if you have local
|
|
||||||
# commits which aren't in git-svn it won't see any revision.
|
|
||||||
git log -10 | grep git-svn-id | head -1 | sed 's/[^@]*@\([0-9]*\).*/\1/'
|
|
||||||
else
|
|
||||||
echo "${DIR} doesn't appear to be git or svn dir." >&2
|
|
||||||
echo 0
|
|
||||||
exit 1
|
|
||||||
fi
|
|
|
@ -16,7 +16,8 @@ fi
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
if [ -d .svn ]; then
|
if [ -d .svn ]; then
|
||||||
svn info . | grep ^Revision | sed 's/Revision: //'
|
# 2>&1 to catch also error output (e.g. svn warnings)
|
||||||
|
svn info . 2>&1 | grep ^Revision | sed 's/Revision: //'
|
||||||
elif [ -d .git ]; then
|
elif [ -d .git ]; then
|
||||||
GIT_PAGER=cat
|
GIT_PAGER=cat
|
||||||
# this grabs more than one line because otherwise if you have local
|
# this grabs more than one line because otherwise if you have local
|
||||||
|
|
Loading…
Reference in New Issue