diff options
Diffstat (limited to 'scripts/setlocalversion')
| -rwxr-xr-x | scripts/setlocalversion | 25 | 
1 files changed, 13 insertions, 12 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index ef8729f4858..63d91e22ed7 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -43,7 +43,8 @@ scm_version()  	fi  	# Check for git and a git repo. -	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then +	if test -z "$(git rev-parse --show-cdup 2>/dev/null)" && +	   head=`git rev-parse --verify --short HEAD 2>/dev/null`; then  		# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore  		# it, because this version is defined in the top level Makefile. @@ -71,12 +72,8 @@ scm_version()  			printf -- '-svn%s' "`git svn find-rev $head`"  		fi -		# Update index only on r/w media -		[ -w . ] && git update-index --refresh --unmerged > /dev/null -  		# Check for uncommitted changes -		if git diff-index --name-only HEAD | grep -v "^scripts/package" \ -		    | read dummy; then +		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then  			printf '%s' -dirty  		fi @@ -86,12 +83,16 @@ scm_version()  	# Check for mercurial and a mercurial repo.  	if test -d .hg && hgid=`hg id 2>/dev/null`; then -		tag=`printf '%s' "$hgid" | cut -s -d' ' -f2` - -		# Do we have an untagged version? -		if [ -z "$tag" -o "$tag" = tip ]; then -			id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` +		# Do we have an tagged version?  If so, latesttagdistance == 1 +		if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then +			id=`hg log -r . --template '{latesttag}'`  			printf '%s%s' -hg "$id" +		else +			tag=`printf '%s' "$hgid" | cut -d' ' -f2` +			if [ -z "$tag" -o "$tag" = tip ]; then +				id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` +				printf '%s%s' -hg "$id" +			fi  		fi  		# Are there uncommitted changes? @@ -105,7 +106,7 @@ scm_version()  	fi  	# Check for svn and a svn repo. -	if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then +	if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then  		rev=`echo $rev | awk '{print $NF}'`  		printf -- '-svn%s' "$rev"  | 
