[llvm] Changed Regex to accept /branch: and /cherry-pick: commands (PR #81002)

Shourya Goel via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 07:26:45 PST 2024


https://github.com/Sh0g0-1758 created https://github.com/llvm/llvm-project/pull/81002

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

PR SUMMARY: Changed Regex to accept /branch: and /cherry-pick: commands.

>From 6ec2d323b8be4a2b6edd91ac6d6791d917bc29a2 Mon Sep 17 00:00:00 2001
From: Sh0g0-1758 <shouryagoel10000 at gmail.com>
Date: Wed, 7 Feb 2024 20:54:17 +0530
Subject: [PATCH] Changed Regex to accept /branch: and /cherry-pick: commands

---
 llvm/utils/git/github-automation.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index e2b84aeca3ad7..7eb76e435b3f3 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -603,16 +603,16 @@ 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>
+        /cherry-pick<:> commit0 <commit1> <commit2> <...>
+        /branch<:> <owner>/<repo>/<branch>
         """
         for line in sys.stdin:
             line.rstrip()
-            m = re.search(r"/([a-z-]+)\s(.+)", line)
+            m = re.search(r"/([a-z-]+)(:?)(?:\s(.+))?", line)
             if not m:
                 continue
             command = m.group(1)
-            args = m.group(2)
+            args = m.group(3)
 
             if command == "cherry-pick":
                 arg_list = args.split()



More information about the llvm-commits mailing list