commit: 8ba6473739253acf96ed2b724874ae6928d0e588 Author: Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz> AuthorDate: Wed Dec 10 14:21:56 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Wed Dec 17 16:40:01 2025 +0000 URL: https://gitweb.gentoo.org/proj/pram.git/commit/?id=8ba64737
Support appending Merges: trailer for Codeberg PRs Make the default behaviour for merging Codeberg PRs to add "Merges:" trailer instead of "Closes:" with the --no-merge option to force the trailer to be "Closes:". Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz> Part-of: https://github.com/gentoo/pram/pull/16 Closes: https://github.com/gentoo/pram/pull/16 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> pram | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pram b/pram index c9df027..d81d865 100755 --- a/pram +++ b/pram @@ -44,10 +44,12 @@ print_help() { echo " Override the pull request the merge is linked to. This" echo " will override the Part-of trailer, as well as the final" echo " Closes trailer." + echo " --no-merge Use a Closes: trailer instead of Merges: trailer" + echo " (for Codeberg PRs)" echo echo "Parameters:" echo " <pr-number> GitHub PR number" - echo " <pr-url> Full URL to the pull request" + echo " <pr-url> Full URL to the pull request (either Github or Codeberg)" echo " <patch-url> URL to a patch file" echo echo "Some options can be specified via 'git config' as well:" @@ -82,6 +84,7 @@ main() { local gpgsign=def local partof=def local link_to= + local merge=def [[ -r ~/.codeberg-token ]] && api_codeberg=1 [[ -r ~/.github-token ]] && api_github=1 @@ -184,6 +187,9 @@ main() { [[ -z ${link_to} ]] || die "${0}: cannot specify multiple ${1%%=*}" link_to=${1#*=} ;; + --no-merge) + merge= + ;; -*) print_usage >&2 exit 1 @@ -281,6 +287,7 @@ main() { *://codeberg.org/*/*/pulls/*) # Codeberg URL to_close=${pr%.patch} + [[ ${merge} == def ]] && merge=1 pr=${to_close}.patch ;; *://codeberg.org/*/*/commit/*|*://codeberg.org/*/*/compare/*) @@ -392,10 +399,13 @@ main() { [[ ${b} != *://* ]] && b=https://bugs.gentoo.org/${b} add_trailer "${patches[-1]}" "Closes: ${b}" done - # append Closes: to the final commit if missing + # append Closes: (or Merges:) to the final commit if missing if [[ -n ${to_close} ]]; then - if ! grep -q "^Closes: ${to_close}" "${patches[-1]}"; then - add_trailer "${patches[-1]}" "Closes: ${to_close}" + local trailer=Closes + [[ ${merge} == 1 ]] && trailer=Merges + + if ! grep -q "^${trailer}: ${to_close}" "${patches[-1]}"; then + add_trailer "${patches[-1]}" "${trailer}: ${to_close}" fi fi
