summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-10-11 13:46:27 +0200
committerYvan Roux <yvan.roux@linaro.org>2017-10-11 13:49:38 +0200
commita165c8fb311eeaeca4e8e7405eb7c53659ae7226 (patch)
treeb3f3b942c80b600ed7917ce0176e235f17df7b17
parent445fbe9a50c7d15d4591bb26b133093a4f7d3933 (diff)
downloadbackflip-a165c8fb311eeaeca4e8e7405eb7c53659ae7226.tar.gz
FSF branch merge helper script.
Change-Id: I32a125312a16e9d78c4ccbb43cf9b8695cdab563
-rwxr-xr-xfsfmerge.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/fsfmerge.sh b/fsfmerge.sh
new file mode 100755
index 0000000..e484fa4
--- /dev/null
+++ b/fsfmerge.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+export GIT_WORK_TREE=/work/sources/gcc.git
+export GIT_DIR="$GIT_WORK_TREE"/.git
+
+NC='\e[0m'
+red='\e[0;31m'
+blue='\e[1;34m'
+bold='\e[1m'
+
+msg() { echo -n -e "${blue}** ${NC}${bold}$1${NC}" ; }
+ask() { msg "$1 " ; eval "read $2"; }
+
+VERSION="$1"
+BRANCH="gcc-${VERSION}-branch"
+DATE=$(date +"%Y-%m")
+MBRANCH="Merge-$BRANCH-$DATE"
+msg "Updating repo\n"
+git remote update
+ask "Creating branch: $MBRANCH [Enter]"
+git checkout -b $MBRANCH origin/$BRANCH
+
+msg "Last branch merge commit:\n"
+git --no-pager log -n 1 --grep="Merge branches/$BRANCH" --pretty=medium origin/linaro/$BRANCH
+
+REV=$(git log -n 1 --grep="Merge branches/$BRANCH" --format="%s" origin/linaro/$BRANCH)
+REV=${REV##* }
+REV=${REV%%.}
+BSHA1=$(git log -n 1 --format="%h" --grep="$BRANCH@$REV" origin/$BRANCH)
+MREV=$(git log -n 1 --format="%b" origin/$BRANCH | grep git-svn-id)
+MSHA1=$(git log -n 1 --format="%h" origin/$BRANCH)
+MREV=${MREV##*@}
+MREV=${MREV%% *}
+
+msg "Remove all rebase entries up to ${red}$BSHA1$\n"
+msg "Keep first line as 'pick' and squash remaining ones (s/^pick/squash/)\n"
+msg "Last commit to merge should be ${red}$MSHA1$\n"
+msg "Branch merge commit message should be:\n"
+msg "Merge branches/$BRANCH rev $MREV.\n"
+ask "Start rebasing [Press key]"
+
+git rebase -i origin/linaro-local/gcc-${VERSION}-integration-branch
+
+if [ $? -ne 0 ]; then
+ msg "Fix the conflicts and continue the rebase with:\n"
+ msg "git rebase --continue\n"
+ msg "Fix ownership with command:\n"
+ msg "git commit --amend --reset-author\n"
+else
+ ask "Fix ownership [Press key]"
+ git commit --amend --reset-author
+fi