MythicSalt/states/jenkins/hg-tag-project

32 lines
1.8 KiB
Bash

#!/bin/sh
#
# hg-tag-project <version> <change>
#
# Called with the current directory at a Mercurial project, this
# adds a tag at the given change with the value 'build-<branch>-<version>'.
# It then pushes the tag to the parent repo.
#
# This is to be used as the final Jenkins build step where a
# build-on-success tag is wanted.
#
usage()
{
echo "Usage: hg-tag-project <version> <change ID>"
exit 1
}
if [ $# -ne 2 ]; then
usage
fi
branch=`hg branch`
echo "hg pull -u"
hg pull -u
echo "hg tag -u 'Jenkins Build Manager <jenkins@lunch.org.uk>' -f -r $2 build-$branch-$1"
hg tag -u "Jenkins Build Manager <jenkins@lunch.org.uk>" -f -r $2 build-$branch-$1
echo "hg push -f"
hg push -f
exit 0