commit: 3a7d648e45fd9d0d4d8afd138284e5e834510da7 Author: Alfred Wingate <parona <AT> protonmail <DOT> com> AuthorDate: Sun Oct 26 07:11:32 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=3a7d648e
Support the same url types in Codeberg as GitHub already does Only thing missing is getting compare patches from the api. Signed-off-by: Alfred Wingate <parona <AT> protonmail.com> Part-of: https://github.com/gentoo/pram/pull/16 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> pram | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pram b/pram index 1bfdce0..c9df027 100755 --- a/pram +++ b/pram @@ -272,11 +272,22 @@ main() { to_close=${pr%%.bugs*} to_close="https://bugs.gentoo.org/${to_close#*://}" ;; + *://codeberg.org/*/*/pulls/*/commits/*) + # Simplify for easier use via the api + pr=${pr/pulls\/*\/commits/commit} + pr=${pr%.patch}.patch + to_close= + ;; *://codeberg.org/*/*/pulls/*) # Codeberg URL to_close=${pr%.patch} pr=${to_close}.patch ;; + *://codeberg.org/*/*/commit/*|*://codeberg.org/*/*/compare/*) + # Codeberg branch/commit diff + pr=${pr%.patch}.patch + to_close= + ;; *://*) # arbitrary URL to_close= @@ -306,10 +317,15 @@ main() { fi if [[ -n ${pr} ]]; then - if [[ -n ${api_codeberg} && ${pr} == *://codeberg.org/*/*/pulls/* ]]; then + if [[ -n ${api_codeberg} && ( + ${pr} == *://codeberg.org/*/commit/* || + #${pr} == *://codeberg.org/*/compare/* || # cannot get a patch for compare via the api + ${pr} == *://codeberg.org/*/*/pulls/* ) + ]]; then # Modify possible patch links to be applicable to the Codeberg REST API # https://codeberg.org/api/swagger pr=${pr/codeberg.org/codeberg.org\/api\/v1\/repos} + pr=${pr/commit/git\/commits} wget --header="Authorization: Bearer $(< ~/.codeberg-token)" \ -O "${tempdir}/all.patch" "${pr}" || die "Fetching patch failed" elif [[ -n ${api_github} && (
