diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2014-02-03 08:04:09 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2014-02-03 08:04:09 +0000 |
commit | 9fa9e83832f976a3b994a1e6b074a708d42b17e3 (patch) | |
tree | 5a07b3748fd92fac885502254e007d671b97fbdb /sys/conf/newvers.sh | |
parent | a2ab687e34bdc01ce26ec4e9739a05838e32c73e (diff) | |
download | FreeBSD-src-9fa9e83832f976a3b994a1e6b074a708d42b17e3.zip FreeBSD-src-9fa9e83832f976a3b994a1e6b074a708d42b17e3.tar.gz |
MFC r256499:
Add support for Mercurial repositories.
Diffstat (limited to 'sys/conf/newvers.sh')
-rw-r--r-- | sys/conf/newvers.sh | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 4a1ad15..13739c2 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -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; |