summaryrefslogtreecommitdiff
path: root/tools/get-scala-revision
diff options
context:
space:
mode:
authorVojin Jovanovic <vojin.jovanovic@epfl.ch>2012-01-09 18:11:10 +0100
committerVojin Jovanovic <vojin.jovanovic@epfl.ch>2012-01-09 18:11:10 +0100
commit1126912bce5d098571c1bd29a04e4781e19c3d85 (patch)
tree79e753014c1adfa26e39e32911125bfc0ad8ee4c /tools/get-scala-revision
parent5a4b555c378d79d57b59dfd6edafd2b9a59866bb (diff)
parent820491ed6376e9f8f8a8102387495113dce55444 (diff)
downloadscala-1126912bce5d098571c1bd29a04e4781e19c3d85.tar.gz
scala-1126912bce5d098571c1bd29a04e4781e19c3d85.tar.bz2
scala-1126912bce5d098571c1bd29a04e4781e19c3d85.zip
Merge branch 'master' into execution-context
Diffstat (limited to 'tools/get-scala-revision')
-rwxr-xr-xtools/get-scala-revision29
1 files changed, 17 insertions, 12 deletions
diff --git a/tools/get-scala-revision b/tools/get-scala-revision
index e8597844cc..b27b6ddc82 100755
--- a/tools/get-scala-revision
+++ b/tools/get-scala-revision
@@ -1,19 +1,24 @@
-#!/bin/sh
+#!/usr/bin/env bash
#
# Usage: get-scala-revision [dir]
# Figures out current scala revision of a git clone.
#
# If no dir is given, current working dir is used.
-[ -n "$1" ] && cd "$1"
+# not like releases come out so often that we are duty-bound
+# to recalculate this every time.
+# git merge-base v2.8.2 v2.9.1 master
+devbase="df13e31bbb"
-# dev should be a tag at the merge-base of master and the
-# most recent release.
-if [ -z $(git tag -l dev) ]; then
- # no dev tag available - this will generate dev-g<sha>
- echo "dev-g$(git describe HEAD --abbrev=7 --always)"
-else
- # dev tag exists - this generates dev-NNNN-g<sha>
- # where NNNN is the number of commits since dev.
- git describe HEAD --abbrev=7 --match dev
-fi
+# reimplementing git describe hopefully in a way which works
+# without any particular tags, branches, or recent versions of git.
+# this is supposed to generate
+# dev-NNNN-g<sha>
+# where NNNN is the number of commits since devbase, which
+# is the merge-base of the most recent release and master.
+# Presently hardcoded to reduce uncertainty, v2.8.2/v2.9.1/master.
+commits=$(git --no-pager log --pretty=oneline $devbase..HEAD | wc -l)
+sha=$(git rev-list -n 1 HEAD)
+datestr=$(date "+%Y-%m-%d")
+
+printf "rdev-%s-%s-g%s\n" $commits $datestr ${sha:0:7}