From 80399cbaab180555ab060a9cac525945f227428f Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 31 Jul 2013 12:52:05 -0400 Subject: [PATCH] Ajout script hg-update-subrepos --- scripts/Makefile.am | 2 +- scripts/hg-update-subrepos | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 scripts/hg-update-subrepos diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 84a7df4..d506774 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -19,7 +19,7 @@ dist_bin_SCRIPTS = \ strip-debug-symbols \ tildes-clean \ vb vd vl vs \ - hg-format-patch \ + hg-format-patch hg-update-subrepos \ git-hg-sub-import \ flac2ogg flac2mp3 \ hv-scan \ 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" -- 2.20.1