summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-12-09 21:22:45 -0800
committerPaul Phillips <paulp@improving.org>2011-12-09 21:22:45 -0800
commitb07fa6bcc4ffe657c28fb43449bf947c4ffe752b (patch)
tree8bcf402a44b1f797e5f13ef99442b10079c587d7
parent23b8216a3b589f07095d43a0405af40bce3c59d1 (diff)
parent7d2db571b41f3c23e91ad27ee5b81a421f312e00 (diff)
downloadscala-b07fa6bcc4ffe657c28fb43449bf947c4ffe752b.tar.gz
scala-b07fa6bcc4ffe657c28fb43449bf947c4ffe752b.tar.bz2
scala-b07fa6bcc4ffe657c28fb43449bf947c4ffe752b.zip
Merge branch 'common' into 2.8.x
-rwxr-xr-xtools/get-scala-revision22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/get-scala-revision b/tools/get-scala-revision
new file mode 100755
index 0000000000..dc0ee561dd
--- /dev/null
+++ b/tools/get-scala-revision
@@ -0,0 +1,22 @@
+#!/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.
+
+# not like releases come out so often that we are duty-bound
+# to recalculate this every time.
+# git merge-base v2.9.1 master
+devbase="d6f3184fc8"
+
+# 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.9.1/master.
+commits=$(GIT_PAGER=cat git log --oneline $devbase..HEAD | wc -l)
+sha=$(git log -1 --abbrev-commit --abbrev=7 --format="%h")
+printf "dev-%s-g%s\n" $commits $sha