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.
This commit is contained in:
Nicki Křížek 2024-08-13 10:33:02 +02:00 committed by Petr Špaček
parent f4e0d0e460
commit 37274bebe1
2 changed files with 4 additions and 6 deletions

View file

@ -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

View file

@ -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