From 9b1ab3d76713d99a11d8da2204557856d59bd3a5 Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Fri, 10 Feb 2012 08:20:13 +1000
Subject: 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>
---
 scripts/makepkg.sh.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'scripts')

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 6a1f3141..a10dc5d3 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -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
-- 
cgit v1.2.3-70-g09d2