# determining reasonable defaults. In addition, the following two variables
# should at least be checked against the output of "git remote -v" in your clone:
#
-# github_repo # The "git remote" name of your Ceph fork on GitHub;
+# fork_remote # The "git remote" name of your Ceph fork on GitHub;
# # defaults to "origin" if not set
-# ceph_repo # The "git remote" name of the Ceph repo on GitHub;
+# upstream_remote # The "git remote" name of the upstream Ceph repo on GitHub;
# # defaults to "upstream" if not set
#
# Without correct values for all of the above variables, this script will not
test "$redmine_user_id" || failed_required_variable_check redmine_user_id
test "$github_token" || failed_required_variable_check github_token
test "$github_user" || failed_required_variable_check github_user
- true "${github_repo:=origin}"
- true "${ceph_repo:=upstream}"
+ if [ -z "$fork_remote" -a -n "$github_repo" ] ; then
+ fork_remote="$github_repo"
+ fi
+ true "${fork_remote:=origin}"
+ if [ -z "$upstream_remote" -a -n "$ceph_repo" ] ; then
+ upstream_remote="$ceph_repo"
+ fi
+ true "${upstream_remote:=upstream}"
true "${redmine_endpoint:="https://tracker.ceph.com"}"
true "${github_endpoint:="https://github.com/ceph/ceph"}"
debug "Redmine user: ${redmine_user_id}"
- debug "GitHub user: ${github_user}"
- debug "Fork remote: ${github_repo}"
- if git remote -v | egrep ^${github_repo}\\s+ ; then
+ debug "GitHub user: ${github_user}"
+ debug "Checking fork remote ->${fork_remote}<-"
+ local fork_remote_exists=$(git remote -v | egrep ^${fork_remote}\\s+)
+ if [ "$fork_remote_exists" ] ; then
true # remote exists; good
else
- error "github_repo is set to ->$github_repo<- but this remote does not exist"
+ error "git remote ->$fork_remote<- not found"
+ info "(Hint: are you setting fork_remote as described in the documentation?)"
exit 1
fi
- debug "Ceph remote: ${ceph_repo}"
- if git remote -v | egrep ^${ceph_repo}\\s+ ; then
+ debug "Checking upstream remote ->${upstream_remote}<-"
+ local upstream_remote_exists=$(git remote -v | egrep ^${upstream_remote}\\s+)
+ if [ "$upstream_remote_exists" ]; then
true # remote exists; good
else
- error "ceph_repo is set to ->$ceph_repo<- but this remote does not exist"
+ error "git remote ->$upstream_remote<- not found"
+ info "(Hint: are you setting upstream_remote as described in the documentation?)"
exit 1
fi
}
fi
info "Found $number commits in ${original_pr_url}"
- debug "Fetching latest commits from $ceph_repo"
- git fetch $ceph_repo
+ debug "Fetching latest commits from $upstream_remote"
+ git fetch $upstream_remote
debug "Initializing local branch $local_branch to $milestone"
if git show-ref --verify --quiet refs/heads/$local_branch ; then
error "Cannot initialize $local_branch - local branch already exists"
exit 1
else
- git checkout $ceph_repo/$milestone -b $local_branch
+ git checkout $upstream_remote/$milestone -b $local_branch
fi
debug "Fetching latest commits from ${original_pr_url}"
- git fetch $ceph_repo pull/$original_pr/head:pr-$original_pr
+ git fetch $upstream_remote pull/$original_pr/head:pr-$original_pr
info "Attempting to cherry pick $number commits from ${original_pr_url} into local branch $local_branch"
let offset=$number-1 || true # don't fail on set -e when result is 0
# at this point, local branch exists and is assumed to contain cherry-pick(s)
#
-debug "Pushing local branch $local_branch to remote $github_repo"
-git push -u $github_repo $local_branch
+debug "Pushing local branch $local_branch to remote $fork_remote"
+git push -u $fork_remote $local_branch
original_issue=""
original_pr=""