Skip to content

Commit

Permalink
ZOOKEEPER-4806: Commits have to be refreshed after merging
Browse files Browse the repository at this point in the history
Reviewers: anmolnar
Author: szucsvillo
Closes #2137 from szucsvillo/ZOOKEEPER-4806
szucsvillo authored Feb 15, 2024
1 parent 18c78cd commit 7074448
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion zk-merge-pr.py
Original file line number Diff line number Diff line change
@@ -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)

try:
run_cmd("git cherry-pick -sx %s" % merge_hash)
except Exception as e:

0 comments on commit 7074448

Please sign in to comment.