changeset 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 9be370486d36
children b7ec26da3d77
files hgRevision.m
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
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