radare2/sys/cherrypull.sh

42 lines
730 B
Bash
Raw Normal View History

2014-05-04 22:45:19 +00:00
#!/bin/sh
2014-06-04 20:33:56 +00:00
[ "$1" = git ] && shift
[ "$1" = pull ] && shift
2014-05-04 22:45:19 +00:00
RR=$1
RB=$2
N=$3
2015-04-17 19:56:01 +00: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-04 22:45:19 +00: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-04 22:45:19 +00:00
git reset --hard @~100
git pull $RR $RB
C=`git log | grep ^commit | head -n $N | cut -d ' ' -f2`
2014-06-23 13:35:09 +00:00
RC=""
git checkout master
2014-05-04 22:45:19 +00:00
for a in $C ; do
RC="$a $RC"
done
2014-06-23 13:35:09 +00:00
for a in $RC ; do
2014-05-04 22:45:19 +00:00
git cherry-pick $a
done
git branch -D branch
2017-03-20 01:09:43 +00:00
if [ -d t/overlay ]; then
make -C t apply
git commit -a
2017-03-20 09:12:59 +00:00
# git reset --hard @^^
2017-03-20 01:09:43 +00:00
fi