GNU bug report logs - #75788
[PATCH] Bug-Reference: Allow referencing sourcehut patch series.

Previous Next

Package: emacs;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Thu, 23 Jan 2025 18:08:01 UTC

Severity: wishlist

Tags: moreinfo, patch

To reply to this bug, email your comments to 75788 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#75788; Package emacs. (Thu, 23 Jan 2025 18:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 23 Jan 2025 18:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Bug-Reference: Allow referencing sourcehut patch series.
Date: Thu, 23 Jan 2025 19:06:50 +0100
[Message part 1 (text/plain, inline)]
Tags: patch


This patch adds a way to bug-reference sourcehut patch series, which are
sometimes used rather than "todo" issues.

In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.18.0)
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/fs9gpdns2r052dcdj8sb1a8f4cv1qb17-emacs-pgtk-29.4
 --enable-fast-install --with-pgtk --with-cairo --with-modules
 --with-native-compilation=aot --disable-build-details'

[0001-Bug-Reference-Allow-referencing-sourcehut-patch-seri.patch (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
-- 
Best regards,
Nicolas Graves

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 25 Jan 2025 00:17:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75788; Package emacs. (Tue, 11 Feb 2025 19:10:02 GMT) Full text and rfc822 format available.

Message #10 received at 75788 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: 75788 <at> debbugs.gnu.org
Subject: Re: bug#75788: [PATCH] Bug-Reference: Allow referencing sourcehut
 patch series.
Date: Tue, 11 Feb 2025 11:09:18 -0800
Nicolas Graves <ngraves <at> ngraves.fr> writes:

> This patch adds a way to bug-reference sourcehut patch series, which are
> sometimes used rather than "todo" issues.

Thanks for the patch.  Could you please add tests for this also?
See bug-reference-tests.el for examples.

Should this be announced in NEWS?




Added tag(s) moreinfo. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 23 Feb 2025 00:20:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75788; Package emacs. (Tue, 04 Mar 2025 01:48:01 GMT) Full text and rfc822 format available.

Message #15 received at 75788 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: 75788 <at> debbugs.gnu.org
Subject: Re: bug#75788: [PATCH] Bug-Reference: Allow referencing sourcehut
 patch series.
Date: Mon, 3 Mar 2025 17:47:46 -0800
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Nicolas Graves <ngraves <at> ngraves.fr> writes:
>
>> This patch adds a way to bug-reference sourcehut patch series, which are
>> sometimes used rather than "todo" issues.
>
> Thanks for the patch.  Could you please add tests for this also?
> See bug-reference-tests.el for examples.
>
> Should this be announced in NEWS?

Friendly ping.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75788; Package emacs. (Fri, 14 Mar 2025 01:02:01 GMT) Full text and rfc822 format available.

Message #18 received at 75788 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 75788 <at> debbugs.gnu.org
Subject: [PATCH v2] Bug-Reference: Allow referencing sourcehut patch series.
Date: Thu, 23 Jan 2025 18:58:20 +0100
* lisp/progmodes/bug-reference.el
(bug-reference--build-forge-setup-entry):  Add ! syntax to reference
sourcehut patch series.

* test/lisp/progmodes/bug-reference.el (test--get-sourcehut-entry,
test-sourcehut-entry): Add procedures.
---
 lisp/progmodes/bug-reference.el            | 22 ++++++++++-----
 test/lisp/progmodes/bug-reference-tests.el | 33 ++++++++++++++++++++++
 2 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index b25c5255f4c..7dec3b0ea0f 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -317,9 +317,10 @@ bug-reference--build-forge-setup-entry
                    (or (match-string-no-properties 2) ns-project)
                    (match-string-no-properties 3)))))))
 
-;; Sourcehut: #19 is an issue.  Other project's issues can be
-;; referenced as ~user/project#19.
-;;
+;; Sourcehut: #19 is an issue. !19 is a patch series
+;; Other project's issues can be referenced as ~user/project#19.
+;; Other project's patch series can be referenced as ~user/project!19.
+
 ;; Caveat: The code assumes that a project on git.sr.ht or hg.sr.ht
 ;; has a tracker of the same name on todo.sh.ht.  That's a very common
 ;; setup but all sr.ht services are loosely coupled, so you can have a
@@ -329,14 +330,21 @@ bug-reference--build-forge-setup-entry
   (host-domain (_forge-type (eql 'sourcehut)) protocol)
   `(,(concat "[/@]\\(?:git\\|hg\\)." (regexp-quote host-domain)
              "[/:]\\(~[.A-Za-z0-9_/-]+\\)")
-    "\\(\\(~[.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\)\\>"
+    "\\(\\(~[.A-Za-z0-9_/-]+\\)?\\([#!]\\)\\([0-9]+\\)\\)\\>"
     ,(lambda (groups)
        (let ((ns-project (nth 1 groups)))
          (lambda ()
-           (format "%s://todo.%s/%s/%s"
-                   protocol host-domain
+           (format "%s://%s.%s/%s%s/%s"
+                   protocol
+                   (if (string= (match-string-no-properties 3) "#")
+                       "todo"
+                     "lists")
+                   host-domain
                    (or (match-string-no-properties 2) ns-project)
-                   (match-string-no-properties 3)))))))
+                   (if (string= (match-string-no-properties 3) "#")
+                       ""
+                     "/patches")
+                   (match-string-no-properties 4)))))))
 
 (defun bug-reference--setup-from-vc-alist (&optional rebuild)
   "Compute the `bug-reference--setup-from-vc-alist' value.
diff --git a/test/lisp/progmodes/bug-reference-tests.el b/test/lisp/progmodes/bug-reference-tests.el
index c8e1e4a78f0..ff7f6903ab4 100644
--- a/test/lisp/progmodes/bug-reference-tests.el
+++ b/test/lisp/progmodes/bug-reference-tests.el
@@ -48,6 +48,13 @@ test--get-gitea-entry
         url)
        (match-string 1 url)))
 
+(defun test--get-sourcehut-entry (url)
+  (and (string-match
+	(car (bug-reference--build-forge-setup-entry
+              "git.sr.ht" 'sourcehut "https"))
+        url)
+       (match-string 1 url)))
+
 (ert-deftest test-github-entry ()
   (should
    (equal
@@ -126,6 +133,32 @@ test-gitea-entry
     (test--get-gitea-entry "https://gitea.com/magit/magit/")
     "magit/magit")))
 
+(ert-deftest test-sourcehut-entry ()
+  (should
+   (equal
+    (test--get-sourcehut-entry "git <at> git.sr.ht:larsmagne/csid.git")
+    "larsmagne/csid"))
+  (should
+   (equal
+    (test--get-sourcehut-entry "git <at> git.sr.ht:larsmagne/csid")
+    "larsmagne/csid"))
+  (should
+   (equal
+    (test--get-sourcehut-entry "https://git.sr.ht/magit/magit.git")
+    "magit/magit"))
+  (should
+   (equal
+    (test--get-sourcehut-entry "https://git.sr.ht/magit/magit.git/")
+    "magit/magit"))
+  (should
+   (equal
+    (test--get-sourcehut-entry "https://git.sr.ht/magit/magit")
+    "magit/magit"))
+  (should
+   (equal
+    (test--get-sourcehut-entry "https://git.sr.ht/magit/magit/")
+    "magit/magit")))
+
 (ert-deftest test-thing-at-point ()
   "Ensure that (thing-at-point 'url) returns the bug URL."
   (ert-with-test-buffer (:name "thingatpt")
-- 
2.48.1



-- 
Best regards,
Nicolas Graves




This bug report was last modified 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.