Repository: james-project Updated Branches: refs/heads/3.1.x 1d675c7c8 -> cdf0bd4c0
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/cdf0bd4c Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/cdf0bd4c Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/cdf0bd4c Branch: refs/heads/3.1.x Commit: cdf0bd4c04e7b97d2624c12cad1838308e353095 Parents: 1d675c7 Author: Antoine Duprat <[email protected]> Authored: Wed Oct 10 15:24:26 2018 +0200 Committer: Antoine Duprat <[email protected]> Committed: Fri Oct 12 13:25:51 2018 +0200 ---------------------------------------------------------------------- dockerfiles/merge/merge.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/cdf0bd4c/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]
