makepkg: deal with mercurial exit codes

From mercurial-2.1, "hg pull" returns 1 when there are no updates.
Catch the return code and either pull the update or return an
error as appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2012-02-10 08:20:13 +10:00 committed by Dan McGee
parent ea32924c62
commit 9b1ab3d767
1 changed files with 7 additions and 2 deletions

View File

@ -1730,8 +1730,13 @@ devel_check() {
msg "$(gettext "Determining latest %s revision...")" 'hg'
if [[ -d ./src/$_hgrepo ]] ; then
cd ./src/$_hgrepo
hg pull
hg update
local ret=0
hg pull || ret=$?
if (( ! ret )); then
hg update
elif (( ret != 1 )); then
return 1
fi
else
[[ ! -d ./src/ ]] && mkdir ./src/
hg clone $_hgroot/$_hgrepo ./src/$_hgrepo