anmolnar commented on code in PR #2137:
URL: https://github.com/apache/zookeeper/pull/2137#discussion_r1488146215
##########
zk-merge-pr.py:
##########
@@ -209,9 +209,21 @@ def cherry_pick(pr_num, merge_hash, default_branch):
pick_branch_name = "%s_PICK_PR_%s_%s" % (TEMP_BRANCH_PREFIX, pr_num,
pick_ref.upper())
- run_cmd("git fetch %s" % PUSH_REMOTE_NAME)
+ run_cmd("git fetch %s" % PR_REMOTE_NAME)
run_cmd("git checkout -b %s %s/%s" % (pick_branch_name, PUSH_REMOTE_NAME,
pick_ref))
+ current_attempt = 0
+ max_attempts = 6
+ # Check if the merge hash exists
+ while not run_cmd("git rev-parse --verify %s" % merge_hash):
+ if current_attempt >= max_attempts:
+ print("Error: The commit hash does not exist in the local
repository.")
+ exit()
+ current_attempt += 1
+ print("Waiting for the merge hash to become available...(10 sec)")
+ time.sleep(10)
+ run_cmd("git fetch %s" % PR_REMOTE_NAME)
+
Review Comment:
As discussed offline I really doubt that this retry logic is needed, since
GitHub pushes the new commit to PR_REMOTE_NAME with the default configuration.
But I'm fine with that. Ship it!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]