svn commit: r342760 - head/sys/conf

Ed Maste emaste at FreeBSD.org
Fri Jan 4 14:42:37 UTC 2019


Author: emaste
Date: Fri Jan  4 14:42:36 2019
New Revision: 342760
URL: https://svnweb.freebsd.org/changeset/base/342760

Log:
  newvers: avoid clearing svn revision information with nested VCS dirs
  
  Consider the case where FreeBSD is checked out via Subversion with a
  (perhaps unrelated) .git or .hg directory at a higher level - for
  example,
  
      .../.git
      .../src/freebsd
  
  Previously newvers obtained the SVN revision information via svnversion,
  and then tried to obtain the SVN revision corresponding to the git or hg
  commit, overwriting the existing information.
  
  As a short term fix use a different variable for hg-svn or git-svn
  information, setting $svn from hg or git info only if not empty.
  
  Reported by:	Matthias Apitz
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Fri Jan  4 04:26:39 2019	(r342759)
+++ head/sys/conf/newvers.sh	Fri Jan  4 14:42:36 2019	(r342760)
@@ -244,21 +244,21 @@ fi
 
 if [ -n "$git_cmd" ] ; then
 	git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null`
-	svn=`$git_cmd svn find-rev $git 2>/dev/null`
-	if [ -n "$svn" ] ; then
-		svn=" r${svn}"
+	gitsvn=`$git_cmd svn find-rev $git 2>/dev/null`
+	if [ -n "$gitsvn" ] ; then
+		svn=" r${gitsvn}"
 		git="=${git}"
 	else
-		svn=`$git_cmd log --grep '^git-svn-id:' | \
+		gitsvn=`$git_cmd log --grep '^git-svn-id:' | \
 		    grep '^    git-svn-id:' | head -1 | \
 		    sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'`
-		if [ -z "$svn" ] ; then
-			svn=`$git_cmd log --format='format:%N' | \
+		if [ -z "$gitsvn" ] ; then
+			gitsvn=`$git_cmd log --format='format:%N' | \
 			     grep '^svn ' | head -1 | \
 			     sed -n 's/^.*revision=\([0-9][0-9]*\).*$/\1/p'`
 		fi
-		if [ -n "$svn" ] ; then
-			svn=" r${svn}"
+		if [ -n "$gitsvn" ] ; then
+			svn=" r${gitsvn}"
 			git="+${git}"
 		else
 			git=" ${git}"
@@ -295,10 +295,10 @@ fi
 
 if [ -n "$hg_cmd" ] ; then
 	hg=`$hg_cmd id 2>/dev/null`
-	svn=`$hg_cmd svn info 2>/dev/null | \
+	hgsvn=`$hg_cmd svn info 2>/dev/null | \
 		awk -F': ' '/Revision/ { print $2 }'`
-	if [ -n "$svn" ] ; then
-		svn=" r${svn}"
+	if [ -n "$hgsvn" ] ; then
+		svn=" r${hgsvn}"
 	fi
 	if [ -n "$hg" ] ; then
 		hg=" ${hg}"


More information about the svn-src-all mailing list