function init_fork_remote {
[ "$github_user" ] || assert_fail "github_user not set"
+ [ "$EXPLICIT_FORK" ] && info "Using explicit fork ->$EXPLICIT_FORK<- instead of personal fork."
fork_remote="${fork_remote:-$(maybe_deduce_remote fork)}"
}
if [ "$remote_type" = "upstream" ] ; then
url_component="ceph"
elif [ "$remote_type" = "fork" ] ; then
- url_component="$github_user"
+ if [ "$EXPLICIT_FORK" ] ; then
+ url_component="$EXPLICIT_FORK"
+ else
+ url_component="$github_user"
+ fi
else
assert_fail "bad remote_type ->$remote_type<- in maybe_deduce_remote"
fi
--debug (turns on "set -x")
--existing-pr BACKPORT_PR_ID
(use this when the backport PR is already open)
+ --fork EXPLICIT_FORK (use EXPLICIT_FORK instead of personal GitHub fork)
--milestones (vet all backport PRs for correct milestone setting)
--setup/-s (run the interactive setup routine - NOTE: this can
be done any number of times)
verbose "Fork remote is $fork_remote"
else
error "Cannot auto-determine fork remote"
- info "(Could not find GitHub user ${github_user}'s fork of ceph/ceph in \"git remote -v\")"
+ if [ "$EXPLICIT_FORK" ] ; then
+ info "(Could not find $EXPLICIT_FORK fork of ceph/ceph in \"git remote -v\")"
+ else
+ info "(Could not find GitHub user ${github_user}'s fork of ceph/ceph in \"git remote -v\")"
+ fi
setup_ok=""
fi
}
[ "$github_token" ] && [ "$setup_ok" ] && set_github_user_from_github_token
init_upstream_remote
[ "$github_token" ] && [ "$setup_ok" ] && init_fork_remote
+ vet_remotes
[ "$redmine_key" ] && set_redmine_user_from_redmine_key
fi
if [ "$github_token" ] ; then
# process command-line arguments
#
-munged_options=$(getopt -o c:dhsv --long "cherry-pick-only,component:,debug,existing-pr:,force,help,milestones,prepare,setup,setup-report,troubleshooting,update-version,usage,verbose,version" -n "$this_script" -- "$@")
+munged_options=$(getopt -o c:dhsv --long "cherry-pick-only,component:,debug,existing-pr:,force,fork:,help,milestones,prepare,setup,setup-report,troubleshooting,update-version,usage,verbose,version" -n "$this_script" -- "$@")
eval set -- "$munged_options"
ADVICE=""
DEBUG=""
EXISTING_PR=""
EXPLICIT_COMPONENT=""
+EXPLICIT_FORK=""
FORCE=""
HELP=""
INTERACTIVE_SETUP_ROUTINE=""
--debug|-d) DEBUG="$1" ; shift ;;
--existing-pr) shift ; EXISTING_PR="$1" ; CHERRY_PICK_PHASE="" ; PR_PHASE="" ; shift ;;
--force) FORCE="$1" ; shift ;;
+ --fork) shift ; EXPLICIT_FORK="$1" ; shift ;;
--help|-h) ADVICE="1" ; HELP="$1" ; shift ;;
--milestones) CHECK_MILESTONES="$1" ; shift ;;
--prepare) CHERRY_PICK_PHASE="yes" ; PR_PHASE="" ; TRACKER_PHASE="" ; shift ;;
[ "$yes_or_no_answer" ] && yes_or_no_answer="${yes_or_no_answer:0:1}"
if [ "$yes_or_no_answer" = "y" ] ; then
INTERACTIVE_SETUP_ROUTINE="yes"
+ else
+ if [ "$FORCE" ] ; then
+ warning "--force was given; proceeding with broken setup"
+ else
+ info "Bailing out!"
+ exit 1
+ fi
fi
fi
fi
fi
debug "Opening backport PR"
- remote_api_output=$(curl --silent --data-binary "{\"title\":\"${backport_pr_title}\",\"head\":\"${github_user}:${local_branch}\",\"base\":\"${target_branch}\",\"body\":\"${desc}\"}" "https://api.github.com/repos/ceph/ceph/pulls?access_token=${github_token}")
+ if [ "$EXPLICIT_FORK" ] ; then
+ source_repo="$EXPLICIT_FORK"
+ else
+ source_repo="$github_user"
+ fi
+ remote_api_output=$(curl --silent --data-binary "{\"title\":\"${backport_pr_title}\",\"head\":\"${source_repo}:${local_branch}\",\"base\":\"${target_branch}\",\"body\":\"${desc}\"}" "https://api.github.com/repos/ceph/ceph/pulls?access_token=${github_token}")
backport_pr_number=$(echo "$remote_api_output" | jq -r .number)
if [ -z "$backport_pr_number" ] || [ "$backport_pr_number" = "null" ] ; then
error "failed to open backport PR"