From 3aee46543642be9e492d16d43b2a302cef219add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Tue, 13 Aug 2024 10:33:02 +0200 Subject: [PATCH] Fix ordering of gitchangelog replacement regexs Prior to this change, the issue number could be accidentally removed by the `Backport of` text, depending on the order of the MR description contents. Ensure all the removals for text in MR descriptions happen first, and only then run the replacement regex for issue number, which appends it to the end of the last non-empty line (which will no longer be removed). The only removals that happen after the replacement are guaranteed to always happen after the end of MR description, since they're auto-generated by gitlab when the merge commit is created, thus won't affect the line with the issue number. Also remove the needless isc-private/bind9 replacement. References to private MRs are already removed by the very first regex. (cherry picked from commit 37274bebe147a1dc95565e3e1bbb2c112778ecbf) --- contrib/gitchangelog/changelog.rc.py | 5 ++--- contrib/gitchangelog/relnotes.rc.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/gitchangelog/changelog.rc.py b/contrib/gitchangelog/changelog.rc.py index e2fd2cf42e..7f8182a574 100644 --- a/contrib/gitchangelog/changelog.rc.py +++ b/contrib/gitchangelog/changelog.rc.py @@ -158,14 +158,13 @@ body_process = ( ReSub(r"\n*See merge request isc-private/bind9!\d+", r"") | ReSub(r"https://gitlab.isc.org/isc-projects/bind9/-/issues/", r"#") | ReSub(r"https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/", r"!") + | ReSub(r"\n*Backport of [^\n]+", r"") + | ReSub(r"\n*(Replaces|Supersedes)[^\n]+", r"") | ReSub( r"\n*(Closes|Fixes|Related|See):?\s*(isc-projects/bind9)?((#|!)\d+)", r" :gl:`\3`", ) - | ReSub(r"\n*Backport of [^\n]+", r"") - | ReSub(r"\n*(Replaces|Supersedes)[^\n]+", r"") | ReSub(r"\n*Merge branch '[^']+' into [^\n]+", r"") - | ReSub(r"\n*isc-private/bind9", r"") | ReSub(r"\n*See merge request isc-projects/bind9(!\d+)", r" :gl:`\1`") | Wrap(regexp="\n\n", separator="\n\n") | strip diff --git a/contrib/gitchangelog/relnotes.rc.py b/contrib/gitchangelog/relnotes.rc.py index dd1a8722c5..8430c7f70c 100644 --- a/contrib/gitchangelog/relnotes.rc.py +++ b/contrib/gitchangelog/relnotes.rc.py @@ -39,14 +39,13 @@ body_process = ( ReSub(r"\n*See merge request isc-private/bind9!\d+", r"") | ReSub(r"https://gitlab.isc.org/isc-projects/bind9/-/issues/", r"#") | ReSub(r"https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/", r"!") + | ReSub(r"\n*Backport of [^\n]+", r"") + | ReSub(r"\n*(Replaces|Supercedes)[^\n]+", r"") | ReSub( r"\n*(Closes|Fixes|Related|See):?\s*(isc-projects/bind9)?((#|!)\d+)", r" :gl:`\3`", ) - | ReSub(r"\n*Backport of [^\n]+", r"") - | ReSub(r"\n*(Replaces|Supercedes)[^\n]+", r"") | ReSub(r"\n*Merge branch '[^']+' into [^\n]+", r"") - | ReSub(r"\n*isc-private/bind9", r"") | ReSub(r"\n*See merge request isc-projects/bind9(!\d+)", r" :gl:`\1`") | Wrap(regexp="\n\n", separator="\n\n") | strip