emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/debbugs 74b2e16 093/311: * Debbugs.wsdl: Add get_userta


From: Stefan Monnier
Subject: [elpa] externals/debbugs 74b2e16 093/311: * Debbugs.wsdl: Add get_usertag specification.
Date: Sun, 29 Nov 2020 18:41:47 -0500 (EST)

branch: externals/debbugs
commit 74b2e16b5a19508abb5588c3c9897185fbf5dcf3
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    * Debbugs.wsdl: Add get_usertag specification.
    
    * debbugs.el (debbugs-get-usertag): New defun.
    
    * debbugs-gnu.el (debbugs-gnu-all-severities)
    (debbugs-gnu-all-packages): New defconst.
    (debbugs-gnu-search, debbugs-gnu): Use them.
    (debbugs-gnu, debbugs-gnu-get-bugs): Handle user tags.
    (debbugs-gnu-show-reports): Kill buffer initially, in order to
    get rid of old local variables.
    (debbugs-gnu-current-query): New defun.
    (debbugs-gnu-display-status): Display also the query.  Use `special-mode'.
---
 Debbugs.wsdl   |  45 +++++++++++++++++++--
 debbugs-gnu.el | 122 ++++++++++++++++++++++++++++++++++++---------------------
 debbugs.el     |  45 +++++++++++++++++++--
 3 files changed, 161 insertions(+), 51 deletions(-)

diff --git a/Debbugs.wsdl b/Debbugs.wsdl
index 4a99550..aefb427 100644
--- a/Debbugs.wsdl
+++ b/Debbugs.wsdl
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!-- Copyright (C) 2011  Free Software Foundation, Inc.
+<!-- Copyright (C) 2011, 2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public 
License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>. -->
 
 <!-- This file describes the bindings of the debbugs SOAP interface
-(see <http://wiki.debian.org/DebbugsSoapInterface>).  The operations
-"get_usertag" and "get_versions" are not contained (yet). -->
+(see <http://wiki.debian.org/DebbugsSoapInterface>).  The operation
+"get_versions" is not contained (yet). -->
 
 <wsdl:definitions
     name="Debbugs/SOAP"
@@ -116,6 +116,14 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>. -->
     <wsdl:part name="soapenc:Array" type="types:ArrayOfBugNumber"/>
   </wsdl:message>
 
+  <wsdl:message name="get_usertagRequest">
+    <wsdl:part name="user" type="xsd:string"/>
+    <!-- We do not support tags -->
+  </wsdl:message>
+  <wsdl:message name="get_usertagResponse">
+    <wsdl:part name="s-gensym3" type="xsd:anyType"/>
+  </wsdl:message>
+
   <wsdl:message name="newest_bugsRequest">
     <wsdl:part name="amount" type="xsd:int"/>
   </wsdl:message>
@@ -177,6 +185,21 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>. -->
       </wsdl:output>
     </wsdl:operation>
 
+    <wsdl:operation name="get_usertag" parameterOrder="user">
+      <wsdl:input message="tns:get_usertagRequest">
+        <soap:body
+           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
+           namespace="urn:Debbugs/SOAP"
+           use="encoded"/>
+      </wsdl:input>
+      <wsdl:output message="tns:get_usertagResponse">
+        <soap:body
+           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
+           namespace="urn:Debbugs/SOAP"
+           use="encoded"/>
+      </wsdl:output>
+    </wsdl:operation>
+
     <wsdl:operation name="newest_bugs" parameterOrder="amount">
       <wsdl:input message="tns:newest_bugsRequest">
         <soap:body
@@ -258,6 +281,22 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>. -->
       </wsdl:output>
     </wsdl:operation>
 
+    <wsdl:operation name="get_usertag">
+      <wsdlsoap:operation soapAction="Debbugs/SOAP"/>
+      <wsdl:input name="get_tagRequest">
+        <wsdlsoap:body
+           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
+           namespace="urn:Debbugs/SOAP"
+           use="encoded"/>
+      </wsdl:input>
+      <wsdl:output name="get_tagResponse">
+        <wsdlsoap:body
+           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
+           namespace="urn:Debbugs/SOAP"
+           use="encoded"/>
+      </wsdl:output>
+    </wsdl:operation>
+
     <wsdl:operation name="newest_bugs">
       <wsdlsoap:operation soapAction="Debbugs/SOAP"/>
       <wsdl:input name="newest_bugsRequest">
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index ca4d73c..35e4124 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -46,8 +46,12 @@
 ;; used, although configured on the GNU bug tracker.  If no severity
 ;; is given, all bugs are selected.
 
-;; There is also the pseudo severity "tagged", which selects locally
-;; tagged bugs.
+;; There is also the pseudo severity "tagged".  When it is used, the
+;; function will ask for user tags (a comma separated list), and shows
+;; just the bugs which are tagged with them.  In general, user tags
+;; shall be strings denoting to subprojects of the package, like
+;; "cedet" or "tramp" of the package "emacs.  If no user tag is given,
+;; locally tagged bugs are shown.
 
 ;; If a prefix is given to the command, more search parameters are
 ;; asked for, like packages (also a comma separated list, "emacs" is
@@ -135,6 +139,10 @@
              (const "tagged"))
   :version "24.1")
 
+(defconst debbugs-gnu-all-severities
+  "*List of all possible severities."
+  (mapcar 'cadr (cdr (get 'debbugs-gnu-default-severities 'custom-type))))
+
 (defcustom debbugs-gnu-default-packages '("emacs")
   "*The list of packages to be searched for."
   ;; <http://debbugs.gnu.org/Packages.html>
@@ -151,6 +159,10 @@
              (const "woodchuck"))
   :version "24.1")
 
+(defconst debbugs-gnu-all-packages
+  "*List of all possible package names."
+  (mapcar 'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type))))
+
 (defcustom debbugs-gnu-default-hits-per-page 500
   "*The number of bugs shown per page."
   :group 'debbugs-gnu
@@ -281,20 +293,15 @@ marked as \"client-side filter\"."
              (setq
               severities
               (completing-read-multiple
-               "Enter severities: "
-               (mapcar
-                'cadr (cdr (get 'debbugs-gnu-default-severities 'custom-type)))
-               nil t
+               "Enter severities: " debbugs-gnu-all-severities nil t
                (mapconcat 'identity debbugs-gnu-default-severities ","))))
 
             ((equal key "package")
              (setq
               packages
               (completing-read-multiple
-               "Enter packages: "
-               (mapcar
-                'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
-               nil t (mapconcat 'identity debbugs-gnu-default-packages ","))))
+               "Enter packages: " debbugs-gnu-all-packages nil t
+               (mapconcat 'identity debbugs-gnu-default-packages ","))))
 
             ((equal key "archive")
              ;; We simplify, by assuming just archived bugs are requested.
@@ -382,26 +389,28 @@ marked as \"client-side filter\"."
          debbugs-gnu-current-filter nil)))
 
 ;;;###autoload
-(defun debbugs-gnu (severities &optional packages archivedp suppress)
+(defun debbugs-gnu (severities &optional packages archivedp suppress usertags)
   "List all outstanding Emacs bugs."
   (interactive
-   (let (archivedp)
+   (let (severities archivedp)
      (list
-      (completing-read-multiple
-       "Severities: "
-       (mapcar 'cadr (cdr (get 'debbugs-gnu-default-severities 'custom-type)))
-       nil t (mapconcat 'identity debbugs-gnu-default-severities ","))
-      ;; The optional parameters are asked only when there is a prefix.
+      (setq severities
+           (completing-read-multiple
+            "Severities: " debbugs-gnu-all-severities nil t
+            (mapconcat 'identity debbugs-gnu-default-severities ",")))
+      ;; The next parameters are asked only when there is a prefix.
       (if current-prefix-arg
          (completing-read-multiple
-          "Packages: "
-          (mapcar 'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
-          nil t (mapconcat 'identity debbugs-gnu-default-packages ","))
+          "Packages: " debbugs-gnu-all-packages nil t
+          (mapconcat 'identity debbugs-gnu-default-packages ","))
        debbugs-gnu-default-packages)
       (when current-prefix-arg
        (setq archivedp (y-or-n-p "Show archived bugs?")))
       (when (and current-prefix-arg (not archivedp))
-       (y-or-n-p "Suppress unwanted bugs?")))))
+       (y-or-n-p "Suppress unwanted bugs?"))
+      ;; This one must be asked for severity "tagged".
+      (when (member "tagged" severities)
+       (split-string (read-string "User tag(s): ") "," t)))))
 
   ;; Initialize variables.
   (when (and (file-exists-p debbugs-gnu-persistency-file)
@@ -420,6 +429,9 @@ marked as \"client-side filter\"."
       (add-to-list 'debbugs-gnu-current-query (cons 'package package))))
   (when archivedp
     (add-to-list 'debbugs-gnu-current-query '(archive . "1")))
+  (dolist (usertag (if (consp usertags) usertags (list usertags)))
+    (when (not (zerop (length usertag)))
+      (add-to-list 'debbugs-gnu-current-query (cons 'usertag usertag))))
 
   (unwind-protect
       (let ((hits debbugs-gnu-default-hits-per-page)
@@ -482,9 +494,12 @@ marked as \"client-side filter\"."
        (tagged (when (member '(severity . "tagged") query)
                  (copy-sequence debbugs-gnu-local-tags)))
        (phrase (assoc 'phrase query))
-       args)
-    ;; Compile query arguments.
-    (unless query
+       usertags args)
+    ;; Compile query and usertags arguments.
+    (dolist (elt query)
+      (when (equal (car elt) 'usertag)
+       (add-to-list 'usertags (cdr elt))))
+    (unless (or query usertags)
       (dolist (elt debbugs-gnu-default-packages)
        (setq args (append args (list :package elt)))))
     (dolist (elt query)
@@ -505,20 +520,28 @@ marked as \"client-side filter\"."
                 (list (intern (concat ":" (symbol-name (car elt))))
                       (cdr elt)))))))
 
-    (cond
-     ;; If the query contains only the pseudo-severity "tagged", we
-     ;; return just the local tagged bugs.
-     ((and tagged (not (memq :severity args)))
-      (sort tagged '<))
-     ;; A full text query.
-     (phrase
-      (append
-       (mapcar
-       (lambda (x) (cdr (assoc "id" x)))
-       (apply 'debbugs-search-est args))
-       tagged))
-     ;; Otherwise, we retrieve the bugs from the server.
-     (t (sort (append (apply 'debbugs-get-bugs args) tagged) '<)))))
+    (sort
+     (cond
+      ;; If the query contains only the pseudo-severity "tagged", we
+      ;; return just the local tagged bugs.
+      ((and tagged (not usertags) (not (memq :severity args))) tagged)
+      ;; A full text query.
+      (phrase
+       (append
+       (mapcar
+        (lambda (x) (cdr (assoc "id" x)))
+        (apply 'debbugs-search-est args))
+       tagged))
+      ;; User tags.
+      (usertags
+       (let (result)
+        (dolist (elt packages result)
+          (setq result
+                (append result (apply 'debbugs-get-usertag elt usertags))))))
+      ;; Otherwise, we retrieve the bugs from the server.
+      (t (append (apply 'debbugs-get-bugs args) tagged)))
+     ;; Sort function.
+     '<)))
 
 (defvar debbugs-gnu-current-widget nil)
 (defvar debbugs-gnu-current-limit nil)
@@ -527,13 +550,16 @@ marked as \"client-side filter\"."
 
 (defun debbugs-gnu-show-reports (widget)
   "Show bug reports as given in WIDGET property :bug-ids."
+  ;; The tabulated mode sets several local variables.  We must get rid
+  ;; of them.
+  (when (get-buffer (widget-get widget :buffer-name))
+    (kill-buffer (widget-get widget :buffer-name)))
   (pop-to-buffer (get-buffer-create (widget-get widget :buffer-name)))
   (debbugs-gnu-mode)
   (let ((inhibit-read-only t)
        (debbugs-port "gnu.org"))
     (erase-buffer)
-    (set (make-local-variable 'debbugs-gnu-current-widget)
-        widget)
+    (set (make-local-variable 'debbugs-gnu-current-widget) widget)
 
     (dolist (status (apply 'debbugs-get-status (widget-get widget :bug-ids)))
       (let* ((id (cdr (assq 'id status)))
@@ -930,13 +956,19 @@ Subject fields."
 (defun debbugs-gnu-current-status ()
   (get-text-property (line-beginning-position) 'tabulated-list-id))
 
-(defun debbugs-gnu-display-status (status)
-  "Display the status of the report on the current line."
-  (interactive (list (debbugs-gnu-current-status)))
+(defun debbugs-gnu-current-query ()
+  (widget-get debbugs-gnu-current-widget :query))
+
+(defun debbugs-gnu-display-status (query status)
+  "Display the query and status of the report on the current line."
+  (interactive (list (debbugs-gnu-current-query)
+                    (debbugs-gnu-current-status)))
   (pop-to-buffer "*Bug Status*")
   (erase-buffer)
-  (pp status (current-buffer))
-  (goto-char (point-min)))
+  (when query (pp query (current-buffer)))
+  (when status (pp status (current-buffer)))
+  (goto-char (point-min))
+  (special-mode))
 
 (defun debbugs-gnu-select-report ()
   "Select the report on the current line."
diff --git a/debbugs.el b/debbugs.el
index ad8c810..adb0ce4 100644
--- a/debbugs.el
+++ b/debbugs.el
@@ -27,8 +27,7 @@
 ;; This package provides some basic functions to access a debbugs SOAP
 ;; server (see <http://wiki.debian.org/DebbugsSoapInterface>).
 
-;; The SOAP functions "get_usertag" and "get_versions" are not
-;; implemented (yet).
+;; The SOAP function "get_versions" is not implemented (yet).
 
 ;;; Code:
 
@@ -274,7 +273,7 @@ Example:
 
   \(debbugs-get-status 10)
 
-  => ;; Attributes with empty values are not show
+  => ;; Attributes with empty values are not shown
      \(\(\(bug_num . 10)
        \(source . \"unknown\")
        \(date . 1203606305.0)
@@ -321,6 +320,46 @@ Example:
           (cdr (assoc 'value x))))
        object))))
 
+(defun debbugs-get-usertag (user &rest tags)
+  "Return a list of bug numbers which are tagged by USER.
+
+USER, a string, is either the email address of the user who has
+applied a user tag, or a pseudo-user like \"emacs\".  Usually,
+pseudo-users are package names.
+
+TAGS is a list of strings applied as user tags.  The returning
+bug numbers list is filtered for these tags.
+
+If TAGS is nil, no bug numbers will be returned but a list of
+existing tags for USER.
+
+Example:
+
+  \(debbugs-get-usertag \"emacs\")
+
+  => (\"www\" \"solaris\" \"ls-lisp\" \"cygwin\")
+
+  \(debbugs-get-usertag \"emacs\" \"www\" \"cygwin\")
+
+  => (807 1223 5637)"
+  (when (stringp user)
+    (let ((object
+          (car (soap-invoke debbugs-wsdl debbugs-port "get_usertag" user)))
+         result)
+      (if (null tags)
+         ;; Return the list of existing tags.
+         (mapcar
+          (lambda (x) (symbol-name (car x)))
+          object)
+
+       ;; Return bug numbers.
+       (mapcar
+        (lambda (x)
+          (when (member (symbol-name (car x)) tags)
+            (setq result (append (cdr x) result))))
+        object)
+       (sort result '<)))))
+
 (defun debbugs-get-bug-log (bug-number)
   "Return a list of messages related to BUG-NUMBER.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]