blob: c9914ba81cc780fcc62700e7496e7c35bc0509f7 [file] [log] [blame]
#!/bin/bash
# The purpose of this script is to checkout the latest branches for all
# submodules within the current aggregator branch. It uses the
# repositories.txt file to determine the submodule to branch mappings.
#
# Usage (all submodules):
# ./scripts/submodules-checkout.sh
# Alternative usage (single submodule):
# ./scripts/submodules-checkout.sh webtools.releng master
#
# This script should be called from the root of the aggregator repo.
# There are two list of repositories, the "normal" and the "patches" the
# In the patches one, only those components that had requested to be included
# in the patch will be used, saving time in the preparation of the environment
if [[ $# -gt 0 ]]; then
pushd $1
if [[ $2 ]]; then
git checkout $2
else
git checkout master
fi
git pull
popd
else
IFS=$'\n' read -d '' -r -a repos < scripts/repositories.txt
for i in "${repos[@]}"
do
repository=$(echo $i | cut -f1 -d: | tr -d ' ')
branch=$(echo $i | cut -f2 -d: | tr -d ' ')
pushd $repository
git checkout $branch
git pull
popd
done
fi