X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=scripts%2Fhg-update-subrepos;fp=scripts%2Fhg-update-subrepos;h=d42b321d2b309f581d9a2182e78a2cdcd1141cee;hb=80399cbaab180555ab060a9cac525945f227428f;hp=0000000000000000000000000000000000000000;hpb=05fb69883a618714e6deed36ab1d526fd81716e0;p=hvutilities.git diff --git a/scripts/hg-update-subrepos b/scripts/hg-update-subrepos new file mode 100755 index 0000000..d42b321 --- /dev/null +++ b/scripts/hg-update-subrepos @@ -0,0 +1,44 @@ +#!/bin/bash +set -o errexit + +# Uncomment to have verbose debug output +debug=1 + +print_usage() +{ + echo "$(basename $0) -- Update HG subrepositories to latest version" + echo "Usage: $(basename $0) [OPTIONS...]" +} + +if [ "x${1}" = "x--help" ]; then + print_usage + exit 1 +fi + +if [ ! -f .hgsub ]; then + echo "No Mercurial subrepositories found" + exit 1 +fi + +# Arg 1: repository path +update_repos() +{ + local repo="${1}" + + pushd "${repo}" + hg pull + hg update + popd +} + +# Tabarnacle d'espaces à marde!!! +OIFS="$IFS" +IFS=$'\n' +for d in $(find . -maxdepth 1 -type d \( \ + -name . -o \ + -name S\* -o \ + -name _S\* \ + \) ); do + update_repos "${d}" +done +IFS="$OIFS"