(svn r14273) -Change: make findversion.sh aware of release tags and make it output the REV without the branch name so the CF can use that.
This commit is contained in:
		@@ -6,7 +6,7 @@ if [ "$#" != "0" ]; then
 | 
				
			|||||||
Usage: ./findversion.sh
 | 
					Usage: ./findversion.sh
 | 
				
			||||||
Finds the current revision and if the code is modified.
 | 
					Finds the current revision and if the code is modified.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Output: <REV>\t<REV_NR>\t<MODIFIED>
 | 
					Output: <REV>\t<REV_NR>\t<MODIFIED>\t<CLEAN_REV>
 | 
				
			||||||
REV
 | 
					REV
 | 
				
			||||||
    a string describing what version of the code the current checkout is
 | 
					    a string describing what version of the code the current checkout is
 | 
				
			||||||
    based on. The exact format of this string depends on the version
 | 
					    based on. The exact format of this string depends on the version
 | 
				
			||||||
@@ -40,6 +40,9 @@ MODIFIED
 | 
				
			|||||||
    A value of 1 means that the modified status is unknown, because this
 | 
					    A value of 1 means that the modified status is unknown, because this
 | 
				
			||||||
    is not an svn/git/hg checkout for example.
 | 
					    is not an svn/git/hg checkout for example.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CLEAN_REV
 | 
				
			||||||
 | 
					    the same as REV but without branch name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
By setting the AWK environment variable, a caller can determine which
 | 
					By setting the AWK environment variable, a caller can determine which
 | 
				
			||||||
version of "awk" is used. If nothing is set, this script defaults to
 | 
					version of "awk" is used. If nothing is set, this script defaults to
 | 
				
			||||||
"awk".
 | 
					"awk".
 | 
				
			||||||
@@ -67,8 +70,13 @@ if [ -d "$ROOT_DIR/.svn" ]; then
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
	# Find the revision like: rXXXXM-branch
 | 
						# Find the revision like: rXXXXM-branch
 | 
				
			||||||
	BRANCH=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'`
 | 
						BRANCH=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'`
 | 
				
			||||||
 | 
						TAGS=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*tags/ { split($2, a, "/"); for(i in a) if (a[i]=="tags") { print a[i+1]; break } }'`
 | 
				
			||||||
	REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
 | 
						REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
 | 
				
			||||||
 | 
						if [ -n "$TAGS" ]; then
 | 
				
			||||||
 | 
							REV=$TAGS
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
		REV="r$REV_NR"
 | 
							REV="r$REV_NR"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
elif [ -d "$ROOT_DIR/.git" ]; then
 | 
					elif [ -d "$ROOT_DIR/.git" ]; then
 | 
				
			||||||
	# We are a git checkout
 | 
						# We are a git checkout
 | 
				
			||||||
	if git diff-index HEAD "$SRC_DIR" | read dummy; then
 | 
						if git diff-index HEAD "$SRC_DIR" | read dummy; then
 | 
				
			||||||
@@ -99,8 +107,10 @@ if [ "$MODIFIED" -eq "2" ]; then
 | 
				
			|||||||
	REV="${REV}M"
 | 
						REV="${REV}M"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CLEAN_REV=${REV}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -n "$BRANCH" ]; then
 | 
					if [ -n "$BRANCH" ]; then
 | 
				
			||||||
	REV="${REV}-$BRANCH"
 | 
						REV="${REV}-$BRANCH"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "$REV	$REV_NR	$MODIFIED"
 | 
					echo "$REV	$REV_NR	$MODIFIED	$CLEAN_REV"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user