summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-23 10:26:20 +0000
committerrubidium <rubidium@openttd.org>2007-09-23 10:26:20 +0000
commit45357015a531c047eb4d6e88279ea51e0d6b46d8 (patch)
tree5018942e2cb3179fe7ec273766f2d455c87a2a9b
parentdb769e490c0c26a5338c0fbc800cade7709fa4ec (diff)
downloadopenttd-45357015a531c047eb4d6e88279ea51e0d6b46d8.tar.xz
(svn r11148) -Codechange: add support for getting version numbers from Mercurial/HG instead of norev000 (when using a Mercurial/HG clone that is).
-rw-r--r--Makefile.src.in10
-rw-r--r--config.lib3
2 files changed, 11 insertions, 2 deletions
diff --git a/Makefile.src.in b/Makefile.src.in
index 7d2be57b3..8aae4f4f8 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -102,8 +102,14 @@ REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$
else
# Are we a git dir?
ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
-# Find the revision like: rXXXXM
-REV := g$(shell if head=`git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if git diff-index HEAD | read dummy; then echo M; fi)$(shell git branch|grep '[*]'|sed 's/\* /-/;s/^-master$$//')
+# Find the revision like: gXXXXM-branch
+REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if git diff-index HEAD | read dummy; then echo M; fi)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
+else
+# Are we a hg (Mercurial) dir?
+ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
+# Find the revision like: hXXXXM-branch
+REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(shell if hg status | grep -v '^?' | read dummy; then echo M; fi)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
+endif
endif
endif
endif
diff --git a/config.lib b/config.lib
index dff8be929..ab3d19a85 100644
--- a/config.lib
+++ b/config.lib
@@ -702,6 +702,9 @@ check_params() {
elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help`" ]; then
revision=""
log 1 "checking revision... git detection"
+ elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help`" ]; then
+ revision=""
+ log 1 "checking revision... hg detection"
else
revision=""
log 1 "checking revision... no detection"