changeset 16:84160e9a0383

scripts/src-version.sh: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 07:23:41 +0000
parents 08ecd0bd517d
children 021ac9f5a765
files scripts/src-version.sh
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/src-version.sh	Fri Oct 16 07:23:41 2020 +0000
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+tmpfile=/tmp/fc_hg_id$$
+
+hg id -in > $tmpfile 2> /dev/null
+if [ $? != 0 ]
+then
+	rm -f $tmpfile
+	echo unknown
+	exit 0
+fi
+
+read global local < $tmpfile
+rm -f $tmpfile
+
+global_noplus=`echo $global | tr -d +`
+local_noplus=`echo $local | tr -d +`
+
+if [ "$global" = "$global_noplus" -a "$local" = "$local_noplus" ]
+then
+	dirty=
+else
+	dirty=-dirty
+fi
+
+echo $local_noplus:$global_noplus$dirty