@@ -7,6 +7,7 @@ set -e
#
# Options:
# -q Be quiet.
+# -C Only check that the changeset exists in the remote repository.
# -o FILE Generate archive in FILE.
# -u URI Clone from repository at URI.
# -c CSET Use changeset (or revision) CSET.
@@ -16,9 +17,11 @@ set -e
# HG : the hg command to call
verbose=
+checkonly=false
while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q;;
+ C) checkonly=true;;
o) output="${OPTARG}";;
u) uri="${OPTARG}";;
c) cset="${OPTARG}";;
@@ -36,6 +39,15 @@ _hg() {
eval ${HG} "${@}"
}
+if ! _hg identify ${verbose} "${@}" --rev "'${cset}'" "'${uri}'" > /dev/null; then
+ printf "Commit '%s' does not exist in this repository\n." "${cset}"
+ exit 1
+fi
+
+if ${checkonly}; then
+ exit 0
+fi
+
_hg clone ${verbose} "${@}" --noupdate "'${uri}'" "'${basename}'"
_hg archive ${verbose} --repository "'${basename}'" --type tgz \