Repository: james-project
Updated Branches:
  refs/heads/master 8f5df4978 -> 02f8d6f73


JAMES-2559 Add original branch parameter in merging tool


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/57b8e7d6
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/57b8e7d6
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/57b8e7d6

Branch: refs/heads/master
Commit: 57b8e7d6903021bc5f98798483261961cdad754c
Parents: 8f5df49
Author: Antoine Duprat <[email protected]>
Authored: Wed Oct 10 15:24:26 2018 +0200
Committer: Benoit Tellier <[email protected]>
Committed: Fri Oct 12 15:24:58 2018 +0700

----------------------------------------------------------------------
 dockerfiles/merge/merge.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/57b8e7d6/dockerfiles/merge/merge.sh
----------------------------------------------------------------------
diff --git a/dockerfiles/merge/merge.sh b/dockerfiles/merge/merge.sh
index 36b321f..a589cb9 100755
--- a/dockerfiles/merge/merge.sh
+++ b/dockerfiles/merge/merge.sh
@@ -2,30 +2,39 @@
 
 printUsage() {
    echo "Usage : "
-   echo "./merge.sh SHA1 RESULTING_BRANCH"
-   echo "    SHA1: SHA1 to merge with master"
+   echo "./merge.sh SHA1 RESULTING_BRANCH ORIGINAL_BRANCH"
+   echo "    SHA1: SHA1 to merge with the branch"
    echo "    RESULTING_BRANCH : Resulting branch of the merge"
+   echo "    ORIGINAL_BRANCH: the original branch used for merge (if none, 
then `master` will be used)"
    exit 1
 }
 
-if [ "$#" -ne 2 ]; then
+if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
     printUsage
 fi
 
 SHA1=$1
 RESULTING_BRANCH=$2
+if [ "$#" -eq 3 ]; then
+    ORIGINAL_BRANCH=$3
+else
+    ORIGINAL_BRANCH=master
+fi
 
 APACHE_REPO=`git remote show | grep apache || true`
 if [ -z "$APACHE_REPO" ]; then
     git remote add apache https://github.com/apache/james-project.git
 fi 
+# Getting original branch from apache repo
 git fetch apache
-git checkout apache/master -b master
+git checkout apache/$ORIGINAL_BRANCH -B $ORIGINAL_BRANCH
 
+# Getting the branch to be merged from /origin
 git fetch origin
 git checkout $SHA1
 git checkout -b SHA1_BRANCH
 
-git checkout master
+# Merging the branch to be merged in the original branch
+git checkout $ORIGINAL_BRANCH
 git checkout -b $RESULTING_BRANCH
 git merge --no-edit SHA1_BRANCH


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to