From 6799c7e00dc0db87bcdf0c7e6fe074eb654046ea Mon Sep 17 00:00:00 2001 From: Sagar Vemuri Date: Thu, 13 Apr 2017 13:22:30 -0700 Subject: [PATCH] Pass in remote as a param to branch creation script Summary: When people are working off of a rocksdb fork, i.e. when their 'origin' points to github.com//rocksdb, the script creates a new branch and pushes to their origin. The new branch created by this script should instead be pushed to github.com/facebook/rocksdb. Many people might have named facebook/rocksdb remote as 'upstream' (or something else). This fix provides an option to specify the remote to push the branch to. The default is still 'origin' More context: When I created 5.4 branch using this script, it got pushed to sagar0/rocksdb instead of facebook/rocksdb, as I was working off of a fork. My 'origin' was pointing to sagar0/rocksdb. My 'upstream' was set to 'facebook/rocksdb'. So, I had to manually push the branch to my 'upstream'. Closes https://github.com/facebook/rocksdb/pull/2156 Differential Revision: D4885333 Pulled By: sagar0 fbshipit-source-id: 9410eab5bd9bbefc340059800bd6b8434406729d --- build_tools/make_new_version.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build_tools/make_new_version.sh b/build_tools/make_new_version.sh index 76a847355..edcb36c1f 100755 --- a/build_tools/make_new_version.sh +++ b/build_tools/make_new_version.sh @@ -17,7 +17,9 @@ function title() { } usage="Create new RocksDB version and prepare it for the release process\n" -usage+="USAGE: ./make_new_version.sh " +usage+="USAGE: ./make_new_version.sh []\n" +usage+=" version: specify a version without '.fb' suffix (e.g. 5.4).\n" +usage+=" remote: name of the remote to push the branch to (default: origin)." # -- Pre-check if [[ $# < 1 ]]; then @@ -27,6 +29,11 @@ fi ROCKSDB_VERSION=$1 +REMOTE="origin" +if [[ $# > 1 ]]; then + REMOTE=$2 +fi + GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` echo $GIT_BRANCH @@ -41,6 +48,6 @@ $GIT checkout -b $BRANCH # Setting up the proxy for remote repo access title "Pushing new branch to remote repo ..." -git push origin --set-upstream $BRANCH +git push $REMOTE --set-upstream $BRANCH title "Branch $BRANCH is pushed to github;"