--- /dev/null
+#!/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"