Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Bug 1822349 - monorepo-migration: avoid some overeager replacements
Browse files Browse the repository at this point in the history
Ensure the `#NNNN` comes after a non-alphanumeric character so we don't turn
e.g. `foo#1234` into
`foohttps://github.com//pull/1234`
  • Loading branch information
jcristau authored and mergify[bot] committed May 30, 2023
1 parent e48f7ac commit 32c7213
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions monorepo-migration/generate-replace-message-expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 32c7213

Please sign in to comment.