[llvm] 9a894e7 - [Github Automation] Allow colon after cherry-pick command (#81002)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 00:28:48 PST 2024


Author: Shourya Goel
Date: 2024-03-05T09:28:44+01:00
New Revision: 9a894e7d84892489826375f94c08ab16ccacc4bb

URL: https://github.com/llvm/llvm-project/commit/9a894e7d84892489826375f94c08ab16ccacc4bb
DIFF: https://github.com/llvm/llvm-project/commit/9a894e7d84892489826375f94c08ab16ccacc4bb.diff

LOG: [Github Automation] Allow colon after cherry-pick command (#81002)

Fixes: https://github.com/llvm/llvm-project/issues/64803

Removed unsupported branch command and changed Regex to
accept /cherry-pick: command.

Added: 
    

Modified: 
    llvm/utils/git/github-automation.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index b475eff06fc3eb..b2e6843eb9af17 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -616,22 +616,20 @@ def create_pull_request(
     def execute_command(self) -> bool:
         """
         This function reads lines from STDIN and executes the first command
-        that it finds.  The 2 supported commands are:
-        /cherry-pick commit0 <commit1> <commit2> <...>
-        /branch <owner>/<repo>/<branch>
+        that it finds.  The supported command is:
+        /cherry-pick< ><:> commit0 <commit1> <commit2> <...>
         """
         for line in sys.stdin:
             line.rstrip()
-            m = re.search(r"/([a-z-]+)\s(.+)", line)
+            m = re.search(r"/cherry-pick\s*:? *(.*)", line)
             if not m:
                 continue
-            command = m.group(1)
-            args = m.group(2)
 
-            if command == "cherry-pick":
-                arg_list = args.split()
-                commits = list(map(lambda a: extract_commit_hash(a), arg_list))
-                return self.create_branch(commits)
+            args = m.group(1)
+
+            arg_list = args.split()
+            commits = list(map(lambda a: extract_commit_hash(a), arg_list))
+            return self.create_branch(commits)
 
         print("Do not understand input:")
         print(sys.stdin.readlines())


        


More information about the llvm-commits mailing list