radare2/sys/cherrypull.sh

42 lines
730 B
Bash
Raw Normal View History

2014-05-05 00:45:19 +02:00
#!/bin/sh
2014-06-04 22:33:56 +02:00
[ "$1" = git ] && shift
[ "$1" = pull ] && shift
2014-05-05 00:45:19 +02:00
RR=$1
RB=$2
N=$3
2015-04-17 21:56:01 +02:00
git diff --exit-code >/dev/null 2>&1
if [ $? != 0 ]; then
echo "ERROR: There are local changes that must be committed or reseted"
echo "ERROR: Cherrypulling process stopped to avoid data loss."
exit 1
fi
2014-05-05 00:45:19 +02:00
if [ -z "$N" ]; then
echo "Usage: sys/cherrypull.sh [url] [branch] [ncommits]"
exit 1
fi
git branch -D branch
git checkout -b branch
2014-05-05 00:45:19 +02:00
git reset --hard @~100
git pull $RR $RB
C=`git log | grep ^commit | head -n $N | cut -d ' ' -f2`
2014-06-23 15:35:09 +02:00
RC=""
git checkout master
2014-05-05 00:45:19 +02:00
for a in $C ; do
RC="$a $RC"
done
2014-06-23 15:35:09 +02:00
for a in $RC ; do
2014-05-05 00:45:19 +02:00
git cherry-pick $a
done
git branch -D branch
2017-03-20 02:09:43 +01:00
if [ -d t/overlay ]; then
make -C t apply
git commit -a
2017-03-20 10:12:59 +01:00
# git reset --hard @^^
2017-03-20 02:09:43 +01:00
fi