diff hgRevision.m @ 891:fd85412c7a99

Add function to get the hgRevision hash as a string
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 22 Nov 2018 07:25:52 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgRevision.m	Thu Nov 22 07:25:52 2018 +0100
@@ -0,0 +1,8 @@
+% Returns the short mercurial revision Id.
+%  ok is false if there are uncommited changes.
+function [revId, ok] = hgRevision()
+    [~, s] = system('hg id -i');
+    revId = strtrim(s);
+
+    ok = s(end) ~= '+';
+end