aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-10-18 21:43:51 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2017-10-20 14:36:01 +0000
commite610a972c653561c9396eff2cf53b756b4bab32c (patch)
tree825f234bb26236f9c2a2dd281c9245d9d3db364f
parente42fbcbccbc28524ab589d19472d7b63dc7a9ee1 (diff)
branch-merge-cmp.sh: Make it easier to use, add comments.
Change-Id: I7cc2f2d1516eca8ffa00dcc95387e7127cdbe490
-rwxr-xr-xbranch-merge-cmp.sh72
1 files changed, 60 insertions, 12 deletions
diff --git a/branch-merge-cmp.sh b/branch-merge-cmp.sh
index b77e310..9543b29 100755
--- a/branch-merge-cmp.sh
+++ b/branch-merge-cmp.sh
@@ -1,18 +1,47 @@
#!/bin/bash
-set -e
+# Helper script for branch-merge reviews.
+#
+# Parameters:
+#
+# git-cmd: the git command to fetch the patch from gerrit. Typically
+# it is the command shown in the gerrit 'download' menu at
+# line 'Format Patch'. Use double quotes around it.
+# branch number: eg 6. Branch identifier.
+# date: branch merge date (eg 2017.10). Used to name directories,
+# etc...
+# svn1: svn revision of the previous branch merge
+# svn2: svn revision of the current branch merge
+#
+# Example:
+# branch-merge-cmp.sh "git fetch ssh://christophe.lyon@review.linaro.org:29418/toolchain/gcc refs/changes/59/21859/1 && git format-patch -1 --stdout FETCH_HEAD" 5 2017.10 247822 253576
+#
+# Prerequisites:
+# - be in a directory containing a git clone of gcc named 'trunk'
+# - have a git work dir with the integration branch named
+# linaro-integration-${BRANCH}
+# - have a ../gcc-svn dir containing svn checkouts of gcc: trunk,
+# gcc-${BRANCH}-branch
+#
+# The script:
+# - updates the remote and 'trunk'
+# - creates 2 work-dirs to hold the merges via git and svn:
+# ${BRANCH}-${DATE}-branch-merge.{git,svn}
+# - updates linaro-integration-${BRANCH}
+# - updates gcc-svn/gcc-${BRANCH}-branch
+# - creates the svn patch
+# - fetches the git patch
+# - applies each patch to the relevant work dir
+# - compares the two work dirs
+#
+# If the patches do not apply, you have to fix the conflicts manually,
+# and re-run the final diff command.
-if [ $# -lt 5 ]
-then
- echo Usage: $0 git-cmd branchnumber date svn1 svn2
- exit 1
-fi
+set -e
-here=`pwd`
-here=`basename $here`
-if [ "$here" != "gcc-linaro-git" ]
+if [ $# -ne 5 ]
then
- echo You must be in the gcc-linaro-git directory.
+ echo "Usage: $0 git-cmd branchnumber date svn1 svn2"
exit 1
fi
@@ -22,6 +51,24 @@ DATE=$3 # 2016.12
SVN1=$4
SVN2=$5
+if [ ! -d trunk ]
+then
+ echo "You must have a trunk subdir (GIT clone)"
+ exit 1
+fi
+
+if [ ! -d linaro-integration-${BRANCH} ]
+then
+ echo "You must have a linaro-integration-${BRANCH} subdir (GIT work dir)"
+ exit 1
+fi
+
+if [ ! -d ../gcc-svn/gcc-${BRANCH}-branch ]
+then
+ echo "You must have a ../gcc-svn/gcc-${BRANCH}-branch dir (SVN checkout)"
+ exit 1
+fi
+
cd trunk
git remote update -p && git rebase
cd ..
@@ -36,11 +83,12 @@ git checkout linaro-local/gcc-${BRANCH}-integration-branch
cd ../${BRANCH}-${DATE}-branch-merge.svn/
git checkout linaro-local/gcc-${BRANCH}-integration-branch
-cd ../../gcc-svn/gcc-${BRANCH}-branch/
+pushd ../../gcc-svn/gcc-${BRANCH}-branch/
svn up
svn diff -r ${SVN1}:${SVN2} > ../${BRANCH}-${DATE}-branch-merge.txt
+popd
-cd ../../gcc-linaro-git/trunk
+cd ../trunk
eval $GITCMD > ../${BRANCH}-${DATE}-branch-merge.txt
cd ../${BRANCH}-${DATE}-branch-merge.git/