[pacman-dev] [PATCH] makepkg: deal with mecurial exit codes

Allan McRae allan at archlinux.org
Thu Feb 9 17:25:28 EST 2012


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

Signed-off-by: Allan McRae <allan at archlinux.org>
---

For maint.

 scripts/makepkg.sh.in |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7d65fd5..edcd3df 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1750,8 +1750,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
-- 
1.7.9



More information about the pacman-dev mailing list