Changeset

6586:317ad7f1c2ba

prosodyctl: Use util.mercurial to identify hg repository and revision
author Kim Alvefur <zash@zash.se>
date Wed, 21 Jan 2015 02:55:23 +0100
parents 6585:ec94dc502113
children 6587:54306208f30b
files prosodyctl
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/prosodyctl	Wed Jan 21 02:55:18 2015 +0100
+++ b/prosodyctl	Wed Jan 21 02:55:23 2015 +0100
@@ -251,6 +251,7 @@
 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 @@
 			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