This is an automated email from the ASF dual-hosted git repository.

zhouky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 28449630f [CELEBORN-937][INFRA] Improve branch suggestion for 
backporting
28449630f is described below

commit 28449630f3fc60318f095773b2e2be68144c00da
Author: Kent Yao <[email protected]>
AuthorDate: Fri Sep 1 00:20:42 2023 +0800

    [CELEBORN-937][INFRA] Improve branch suggestion for backporting
    
    ### What changes were proposed in this pull request?
    
    This PR automatically iterates to the next branch to be merged instead of 
using the latest all the time
    
    ### Why are the changes needed?
    
    anti-misoperation
    
    ### Does this PR introduce _any_ user-facing change?
    
    no
    
    ### How was this patch tested?
    
    manully
    
    Closes #1870 from yaooqinn/CELEBORN-937.
    
    Authored-by: Kent Yao <[email protected]>
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 dev/merge_pr.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dev/merge_pr.py b/dev/merge_pr.py
index 35c4602a9..f46370d59 100755
--- a/dev/merge_pr.py
+++ b/dev/merge_pr.py
@@ -528,7 +528,8 @@ def main():
     branches = get_json("%s/branches" % GITHUB_API_BASE)
     branch_names = list(filter(lambda x: x.startswith("branch-"), [x["name"] 
for x in branches]))
     # Assumes branch names can be sorted lexicographically
-    latest_branch = sorted(branch_names, reverse=True)[0]
+    branch_names = sorted(branch_names, reverse=True)
+    branch_iter = iter(branch_names)
 
     pr_num = input("Which pull request would you like to merge? (e.g. 34): ")
     pr = get_json("%s/pulls/%s" % (GITHUB_API_BASE, pr_num))
@@ -600,7 +601,7 @@ def main():
             fail("Couldn't find any merge commit for #%s, you may need to 
update HEAD." % pr_num)
 
         print("Found commit %s:\n%s" % (merge_hash, message))
-        cherry_pick(pr_num, merge_hash, latest_branch)
+        cherry_pick(pr_num, merge_hash, next(branch_iter, branch_names[0]))
         sys.exit(0)
 
     if not bool(pr["mergeable"]):
@@ -620,7 +621,9 @@ def main():
 
     pick_prompt = "Would you like to pick %s into another branch?" % merge_hash
     while input("\n%s (y/n): " % pick_prompt).lower() == "y":
-        merged_refs = merged_refs + [cherry_pick(pr_num, merge_hash, 
latest_branch)]
+        merged_refs = merged_refs + [
+            cherry_pick(pr_num, merge_hash, next(branch_iter, branch_names[0]))
+        ]
 
     if asf_jira is not None:
         continue_maybe("Would you like to update an associated JIRA?")

Reply via email to