blob: 89ae6cb2662d1d3d06bf47f2c2dc9b6bef278986 [file] [log] [blame]
Yvan Rouxa165c8f2017-10-11 13:46:27 +02001#!/bin/bash
2
Maxim Kuvyrkov82ab9532018-03-07 14:27:36 +00003export GIT_WORK_TREE=$(pwd)
Yvan Rouxa165c8f2017-10-11 13:46:27 +02004export GIT_DIR="$GIT_WORK_TREE"/.git
5
6NC='\e[0m'
7red='\e[0;31m'
8blue='\e[1;34m'
9bold='\e[1m'
10
11msg() { echo -n -e "${blue}** ${NC}${bold}$1${NC}" ; }
12ask() { msg "$1 " ; eval "read $2"; }
13
14VERSION="$1"
15BRANCH="gcc-${VERSION}-branch"
16DATE=$(date +"%Y-%m")
17MBRANCH="Merge-$BRANCH-$DATE"
18msg "Updating repo\n"
19git remote update
20ask "Creating branch: $MBRANCH [Enter]"
21git checkout -b $MBRANCH origin/$BRANCH
22
23msg "Last branch merge commit:\n"
24git --no-pager log -n 1 --grep="Merge branches/$BRANCH" --pretty=medium origin/linaro/$BRANCH
25
26REV=$(git log -n 1 --grep="Merge branches/$BRANCH" --format="%s" origin/linaro/$BRANCH)
27REV=${REV##* }
28REV=${REV%%.}
29BSHA1=$(git log -n 1 --format="%h" --grep="$BRANCH@$REV" origin/$BRANCH)
30MREV=$(git log -n 1 --format="%b" origin/$BRANCH | grep git-svn-id)
31MSHA1=$(git log -n 1 --format="%h" origin/$BRANCH)
32MREV=${MREV##*@}
33MREV=${MREV%% *}
34
Maxim Kuvyrkov5ebe69f2018-03-07 14:22:03 +000035msg "Remove all rebase entries up to and including ${red}$BSHA1$\n"
Yvan Rouxa165c8f2017-10-11 13:46:27 +020036msg "Keep first line as 'pick' and squash remaining ones (s/^pick/squash/)\n"
37msg "Last commit to merge should be ${red}$MSHA1$\n"
38msg "Branch merge commit message should be:\n"
39msg "Merge branches/$BRANCH rev $MREV.\n"
40ask "Start rebasing [Press key]"
41
42git rebase -i origin/linaro-local/gcc-${VERSION}-integration-branch
43
44if [ $? -ne 0 ]; then
45 msg "Fix the conflicts and continue the rebase with:\n"
46 msg "git rebase --continue\n"
47 msg "Fix ownership with command:\n"
48 msg "git commit --amend --reset-author\n"
49else
50 ask "Fix ownership [Press key]"
51 git commit --amend --reset-author
52fi