Add support for an optional version suffix string.
This commit is contained in:
parent
1787d9e42c
commit
21acc624e1
1 changed files with 9 additions and 7 deletions
16
revision.sh
16
revision.sh
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "usage: $(basename $0) (-d | <base version>)" >&2
|
echo "usage: $(basename $0) (-d | <base version> [<version suffix>])" >&2
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ shift $(($OPTIND - 1))
|
||||||
|
|
||||||
case $func in
|
case $func in
|
||||||
revision)
|
revision)
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -lt 1 -o $# -gt 2 ]; then
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -44,14 +44,15 @@ esac
|
||||||
|
|
||||||
_revision()
|
_revision()
|
||||||
{
|
{
|
||||||
echo $1
|
echo $1$2
|
||||||
}
|
}
|
||||||
|
|
||||||
git_revision()
|
git_revision()
|
||||||
{
|
{
|
||||||
local ver describe untagged commits branch sha dirty
|
local ver versuffix describe untagged commits branch sha dirty
|
||||||
|
|
||||||
ver=$1
|
ver=$1
|
||||||
|
versuffix=$2
|
||||||
|
|
||||||
describe=$(git describe --tags --dirty 2> /dev/null)
|
describe=$(git describe --tags --dirty 2> /dev/null)
|
||||||
if [ "$describe" ]; then
|
if [ "$describe" ]; then
|
||||||
|
@ -87,14 +88,15 @@ git_revision()
|
||||||
dirty=""
|
dirty=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ${ver}${untagged}${commits}${branch}${sha}${dirty}
|
echo ${ver}${versuffix}${untagged}${commits}${branch}${sha}${dirty}
|
||||||
}
|
}
|
||||||
|
|
||||||
svn_revision()
|
svn_revision()
|
||||||
{
|
{
|
||||||
local ver tagrev untagged commits rev dirty
|
local ver versuffix tagrev untagged commits rev dirty
|
||||||
|
|
||||||
ver=$1
|
ver=$1
|
||||||
|
versuffix=$1
|
||||||
|
|
||||||
tagrev=$(svn log -q ^/tags/release-$ver --limit 1 2> /dev/null | \
|
tagrev=$(svn log -q ^/tags/release-$ver --limit 1 2> /dev/null | \
|
||||||
awk '/^r/ {print $1}')
|
awk '/^r/ {print $1}')
|
||||||
|
@ -117,7 +119,7 @@ svn_revision()
|
||||||
dirty=".dirty"
|
dirty=".dirty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ${ver}${untagged}${commits}${rev}${dirty}
|
echo ${ver}${versuffix}${untagged}${commits}${rev}${dirty}
|
||||||
}
|
}
|
||||||
|
|
||||||
_date()
|
_date()
|
||||||
|
|
Loading…
Add table
Reference in a new issue