From: Nicki Křížek Date: Tue, 13 Aug 2024 08:33:02 +0000 (+0200) Subject: Fix ordering of gitchangelog replacement regexs X-Git-Tag: v9.21.1~52^2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=37274bebe147a1dc95565e3e1bbb2c112778ecbf;p=thirdparty%2Fbind9.git 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. --- diff --git a/contrib/gitchangelog/changelog.rc.py b/contrib/gitchangelog/changelog.rc.py index e2fd2cf42e0..7f8182a5742 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 dd1a8722c59..8430c7f70c3 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