Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

hget: enhanced to exit cleanly if no mq repos is found
authorMichael Gebetsroither <michael.geb@gmx.at>
Wed Oct 31 16:04:06 2007 +0100 (13 months ago)
changeset 175bde592fc81d0
manifestbde592fc81d0
parent 17470a5b74598fc
child 1765775e9b50767
tag0.26
hget: enhanced to exit cleanly if no mq repos is found
debian/changelog
hget
--- a/debian/changelog Wed Oct 31 16:03:39 2007 +0100
+++ b/debian/changelog Wed Oct 31 16:04:06 2007 +0100
@@ -1,3 +1,9 @@ grml-mercurial-utils (0.25) unstable; ur
+grml-mercurial-utils (0.26) unstable; urgency=low
+
+ * enhanced hget to exit cleanly if no mq repos is found
+
+ -- Michael Gebetsroither <gebi@grml.org> Wed, 31 Oct 2007 16:02:58 +0100
+
grml-mercurial-utils (0.25) unstable; urgency=low
* reposearch: fix recursive searching
--- a/hget Wed Oct 31 16:03:39 2007 +0100
+++ b/hget Wed Oct 31 16:04:06 2007 +0100
@@ -19,8 +19,6 @@ if (( $# != 1 )); then
printUsage
fi
-set -e
-
NAME_="`basename $1`"
DURL_="`dirname $1`"
if [[ $DURL_ == "." ]]; then
@@ -28,10 +26,21 @@ fi
fi
URL_="${DURL_}/${NAME_}"
+# clone source
if [ ! -d "$NAME_" ]; then
- hg clone ${URL_}
+ hg clone ${URL_} || exit 1
fi
-hg clone ${URL_}.mq
-ln -s ../../${NAME_}.mq ${NAME_}/.hg/patches
+
+# clone possibel mq
+output_="`hg clone ${URL_}.mq 2>&1`"
+ret_=$?
+if [[ $ret_ != "0" ]]; then
+ if echo "$output_" |grep -q "does not appear to be an hg repository!$"; then
+ exit 0
+ fi
+ echo "$output_" 1>&2
+ exit $ret_
+fi
+ln -s ../../${NAME_}.mq ${NAME_}/.hg/patches || exit 1
# vim: filetype=sh