Ajout script hg-update-subrepos
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 31 Jul 2013 16:52:05 +0000 (12:52 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 31 Jul 2013 18:07:11 +0000 (14:07 -0400)
scripts/Makefile.am
scripts/hg-update-subrepos [new file with mode: 0755]

index 84a7df4..d506774 100644 (file)
@@ -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 (executable)
index 0000000..d42b321
--- /dev/null
@@ -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"