From 32c72134117206b81ad3eb178ff82ab2f97bde31 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Mon, 29 May 2023 13:13:13 +0200 Subject: [PATCH] Bug 1822349 - monorepo-migration: avoid some overeager replacements Ensure the `#NNNN` comes after a non-alphanumeric character so we don't turn e.g. `foo#1234` into `foohttps://github.com/mozilla-mobile/firefox-android/pull/1234` --- monorepo-migration/generate-replace-message-expressions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monorepo-migration/generate-replace-message-expressions.py b/monorepo-migration/generate-replace-message-expressions.py index cd4e411fe5ae..c709b8ee406e 100755 --- a/monorepo-migration/generate-replace-message-expressions.py +++ b/monorepo-migration/generate-replace-message-expressions.py @@ -44,10 +44,10 @@ def main(): for number_type in ("issues", "pulls"): for chunk in divide_chunks(numbers[number_type], 100): - regex = "regex:(({repo_owner}/)?{repo_name}){repo_suffix}#({current_numbers})(\D|$)==>{url}/\\3\\4\n".format( + regex = (r"regex:(\W)(({repo_owner}/)?{repo_name}){repo_suffix}#({current_numbers})(\D|$)==>\1{url}/\4\5" "\n").format( repo_owner=REPO_OWNER, repo_name=f"[{repo_name[0].upper()}{repo_name[0].lower()}]{repo_name[1:]}", - repo_suffix="?" if repo_name == REPO_NAME_TO_IMPORT else "\\s*", + repo_suffix=r"?" if repo_name == REPO_NAME_TO_IMPORT else r"\s*", current_numbers="|".join(str(number) for number in chunk), url=GITHUB_URL_TEMPLATE.format( repo_owner=REPO_OWNER,