| #!/bin/sh -e |
| . "`dirname $0`"/common |
| |
| TREE="`echo $1 |sed -e 's,\.git$,,'`" |
| [ -z "$TREE" ] && exit 1 |
| B=`basename $TREE` |
| D=`dirname $TREE` |
| |
| OK=false |
| if [ -d $SRC/$TREE ]; then |
| cd $SRC/$TREE |
| git pull |
| git fetch --all |
| if [ -n "$2" ]; then |
| if echo $2 |grep -q refs/tags/; then |
| if git checkout `basename $2`; then |
| OK=true |
| fi |
| elif git checkout -b $2 origin/$2; then |
| OK=true |
| elif git checkout -b $2 origin/$2 2>&1 |grep -q "already exists"; then |
| OK=true |
| fi |
| if ! $OK; then |
| if git checkout `basename $2`; then |
| OK=true |
| fi |
| fi |
| fi |
| exit 0 |
| fi |
| |
| mkdir -p $SRC/$D |
| cd $SRC/$D |
| git clone git://android.git.linaro.org/$TREE.git |
| cd $B |
| [ -n "$EMAIL" ] && git config user.email $EMAIL |
| git remote add gerrit ssh://$USER@android.git.linaro.org:29418/$TREE.git |
| git remote add aosp https://android-review.googlesource.com/$TREE.git |
| # No way to do this without hardcodes... |
| case $TREE in |
| platform/external/ffmpeg) |
| git remote add upstream git://source.ffmpeg.org/ffmpeg.git |
| ;; |
| platform/external/x264) |
| git remote add upstream git://git.videolan.org/x264.git |
| ;; |
| platform/external/busybox) |
| git remote add upstream git://busybox.net/busybox.git |
| ;; |
| toolchain/binutils-current) |
| git remote add upstream git://sourceware.org/git/binutils.git |
| git remote add hjl git://git.kernel.org/pub/scm/linux/kernel/git/hjl/binutils.git |
| ;; |
| esac |
| git fetch aosp || git remote rm aosp |
| git fetch --all |
| if [ -n "$2" ]; then |
| if echo $2 |grep -q refs/tags/; then |
| if git checkout `basename $2`; then |
| OK=true |
| fi |
| elif git checkout -b $2 origin/$2; then |
| OK=true |
| elif git checkout -b $2 origin/$2 2>&1 |grep -q "already exists"; then |
| OK=true |
| fi |
| fi |
| if ! $OK; then |
| for i in $VERSIONS; do |
| if git checkout -b $i origin/$i; then |
| OK=true |
| break |
| elif git checkout -b $i origin/$i 2>&1 |grep -q "already exists"; then |
| OK=true |
| break |
| fi |
| done |
| fi |
| if ! $OK; then |
| git checkout android-${ANDROIDVERSION}_r${ANDROIDREVISION} |
| fi |
| scp -P 29418 $USER@android.git.linaro.org:hooks/commit-msg .git/hooks/ |