Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created September 3, 2014 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invisiblek/feb442432387961bcc20 to your computer and use it in GitHub Desktop.
Save invisiblek/feb442432387961bcc20 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$1" == "careful" ] || [ "$2" == "careful" ]; then
set -e
fi
PWD=`pwd`
pickfile=~/.bin/repopicks
count=0
source build/envsetup.sh > /dev/null
while read line; do
p=`echo $line | awk '{print $1}'`
echo "repopicking: $p"
if [ "$p" != "skip" ]; then
output=`repopick $p`
if [[ "$output" != "${output/'Commit already merged. Skipping the cherry pick.'}" ]]
then
echo "removing $p from the script"
sed -i "s|$line||g" $pickfile
sed -i "/^$/d" $pickfile
/home/dp/.bin/email "build@invisiblek.org" "dan.pasanen@gmail.com" "Merged cherry pick removed from auto pick script" "\n\n$line" "invisiblek.org" "build@invisiblek.org"
fi
else
p=`echo $line | awk '{print $2}'`
echo "Skipping $p"
fi
echo ""
count=`expr $count + 1`
done < $pickfile
while read line; do
user=`echo $line | awk '{print $1}'`
if [ "$user" != "skip" ]; then
repo=`echo $line | awk '{print $2}'`
commit=`echo $line | awk '{print $3}'`
localrepo=`echo $line | awk '{print $4}'`
cd $localrepo
if [ "$2" == "careful" ]; then
set +e
fi
set +e
git remote add $user http://github.com/$user/$repo
set -e
if [ "$2" == "careful" ]; then
set -e
fi
git fetch $user
git cherry-pick $commit
cd -
fi
done < ~/.bin/cherrypicks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment