Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2013 05:50:03 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r256499 - head/sys/conf
Message-ID:  <201310150550.r9F5o36U028212@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Tue Oct 15 05:50:02 2013
New Revision: 256499
URL: http://svnweb.freebsd.org/changeset/base/256499

Log:
  Add support for Mercurial repositories.

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Tue Oct 15 04:54:49 2013	(r256498)
+++ head/sys/conf/newvers.sh	Tue Oct 15 05:50:02 2013	(r256499)
@@ -130,6 +130,15 @@ if [ -d "${SYSDIR}/../.git" ] ; then
 	done
 fi
 
+if [ -d "${SYSDIR}/../.hg" ] ; then
+	for dir in /usr/bin /usr/local/bin; do
+		if [ -x "${dir}/hg" ] ; then
+			hg_cmd="${dir}/hg -R ${SYSDIR}/../.hg"
+			break
+		fi
+	done
+fi
+
 if [ -n "$svnversion" ] ; then
 	svn=`cd ${SYSDIR} && $svnversion 2>/dev/null`
 	case "$svn" in
@@ -184,12 +193,23 @@ if [ -n "$p4_cmd" ] ; then
 	*)	unset p4version ;;
 	esac
 fi
-	
+
+if [ -n "$hg_cmd" ] ; then
+	hg=`$hg_cmd id 2>/dev/null`
+	svn=`$hg_cmd svn info 2>/dev/null | \
+		awk -F': ' '/Revision/ { print $2 }'`
+	if [ -n "$svn" ] ; then
+		svn=" r${svn}"
+	fi
+	if [ -n "$hg" ] ; then
+		hg=" ${hg}"
+	fi
+fi
 
 cat << EOF > vers.c
 $COPYRIGHT
-#define SCCSSTR "@(#)${VERSION} #${v}${svn}${git}${p4version}: ${t}"
-#define VERSTR "${VERSION} #${v}${svn}${git}${p4version}: ${t}\\n    ${u}@${h}:${d}\\n"
+#define SCCSSTR "@(#)${VERSION} #${v}${svn}${git}${hg}${p4version}: ${t}"
+#define VERSTR "${VERSION} #${v}${svn}${git}${hg}${p4version}: ${t}\\n    ${u}@${h}:${d}\\n"
 #define RELSTR "${RELEASE}"
 
 char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310150550.r9F5o36U028212>