[LLVMdev] A script for updating all the nested git clients
David Blaikie
dblaikie at gmail.com
Tue Aug 21 10:38:01 PDT 2012
There's functionality in the make build to update (at least one layer
of) nested svn working copies of LLVM, but nothing in cmake and
nothing for git in either. I use the following script & after updating
it to handle arbitrary nesting (with the advent of the
clang-tools-extra repository) & generalize the discovery (had a
hardcoded list & after fixing up the Make build after some changes I
made I used something similar for my script) I figured I'd send it out
in case other people would like to use it (or just tell me why/how I'm
doing it wrong, if they think I am):
#!/bin/sh
if ! git remote -v 2> /dev/null | grep "http://llvm.org/git" > /dev/null; then
echo "Not an llvm git repo"
exit 1
fi
while ! git remote -v 2> /dev/null | grep
"http://llvm.org/git/llvm.git" > /dev/null; do
if ! git remote -v 2> /dev/null > /dev/null; then
echo "Could not find the root of the llvm git repository"
exit 1
fi
cd `git rev-parse --show-toplevel`/../
done
cd `git rev-parse --show-toplevel` > /dev/null
function fetchAndRebase {
if [ -d $1 ]; then
pushd $1 > /dev/null
if git status > /dev/null; then
git stash | grep "No local changes to save" > /dev/null
STASHED=$?
git fetch > /dev/null
git svn rebase -l > /dev/null
if [ $STASHED -ne 0 ]; then git stash pop > /dev/null; fi
for dir in `git status --ignored | grep /$ | sed -e "s/^#//"`; do
fetchAndRebase $dir
done
fi
popd > /dev/null
fi
}
fetchAndRebase `git rev-parse --show-toplevel`
More information about the llvm-dev
mailing list