From 7193adf5d5cbc0a0bd0e49488b4590e3dff19ab2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 21 Jan 2015 02:55:23 +0100 Subject: prosodyctl: Use util.mercurial to identify hg repository and revision --- prosodyctl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prosodyctl b/prosodyctl index 60bc0c08..c7daceac 100755 --- a/prosodyctl +++ b/prosodyctl @@ -251,6 +251,7 @@ require "socket" function read_version() -- Try to determine version local version_file = io.open((CFG_SOURCEDIR or ".").."/prosody.version"); + prosody.version = "unknown"; if version_file then prosody.version = version_file:read("*a"):gsub("%s*$", ""); version_file:close(); @@ -258,7 +259,9 @@ function read_version() prosody.version = "hg:"..prosody.version; end else - prosody.version = "unknown"; + local hg = require"util.mercurial"; + local hgid = hg.check_id(CFG_SOURCEDIR or "."); + if hgid then prosody.version = "hg:" .. hgid; end end end -- cgit v1.2.3