# HG changeset patch # User Kim Alvefur # Date 1421805323 -3600 # Node ID 317ad7f1c2ba61c65cd11a84957ab67ebb10b5fb # Parent ec94dc5021137b5de6e755321dae670ed12de2d6 prosodyctl: Use util.mercurial to identify hg repository and revision diff -r ec94dc502113 -r 317ad7f1c2ba prosodyctl --- 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