From 0b1585235f00d0646358df811f209ef988f94d9f Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 21 May 2025 14:40:40 +0200 Subject: [PATCH] update ghub --- elpa/ghub-20250509.1440/.dir-locals.el | 9 + .../buck.el | 11 +- .../dir | 0 .../ghub-autoloads.el | 0 .../ghub-graphql.el | 160 ++++++++++++---- .../ghub-pkg.el | 9 +- .../ghub.el | 172 ++++++++---------- .../ghub.info | 71 +++----- .../glab.el | 2 +- .../gogs.el | 13 +- .../gsexp.el | 2 +- .../gtea.el | 13 +- 12 files changed, 269 insertions(+), 193 deletions(-) create mode 100644 elpa/ghub-20250509.1440/.dir-locals.el rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/buck.el (94%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/dir (100%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/ghub-autoloads.el (100%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/ghub-graphql.el (83%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/ghub-pkg.el (68%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/ghub.el (87%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/ghub.info (97%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/glab.el (99%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/gogs.el (93%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/gsexp.el (98%) rename elpa/{ghub-20241208.2219 => ghub-20250509.1440}/gtea.el (93%) diff --git a/elpa/ghub-20250509.1440/.dir-locals.el b/elpa/ghub-20250509.1440/.dir-locals.el new file mode 100644 index 00000000..aff6808e --- /dev/null +++ b/elpa/ghub-20250509.1440/.dir-locals.el @@ -0,0 +1,9 @@ +((nil + (indent-tabs-mode . nil)) + (makefile-mode + (indent-tabs-mode . t)) + (git-commit-mode + (git-commit-major-mode . git-commit-elisp-text-mode)) + ("CHANGELOG" + (nil (fill-column . 70) + (mode . display-fill-column-indicator)))) diff --git a/elpa/ghub-20241208.2219/buck.el b/elpa/ghub-20250509.1440/buck.el similarity index 94% rename from elpa/ghub-20241208.2219/buck.el rename to elpa/ghub-20250509.1440/buck.el index fff45968..0a56a10f 100644 --- a/elpa/ghub-20241208.2219/buck.el +++ b/elpa/ghub-20250509.1440/buck.el @@ -1,6 +1,6 @@ ;;; buck.el --- Client library for the Bitbucket API -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub @@ -50,6 +50,7 @@ "Make a `GET' request for RESOURCE, with optional query PARAMS. Like calling `ghub-request' (which see) with \"GET\" as METHOD and `bitbucket' as FORGE." + (declare (obsolete ghub-get "4.3.1")) (ghub-request "GET" resource params :forge 'bitbucket :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -65,6 +66,7 @@ and `bitbucket' as FORGE." "Make a `PUT' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PUT\" as METHOD and `bitbucket' as FORGE." + (declare (obsolete ghub-put "4.3.1")) (ghub-request "PUT" resource params :forge 'bitbucket :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -80,6 +82,7 @@ and `bitbucket' as FORGE." "Make a `POST' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"POST\" as METHOD and `bitbucket' as FORGE." + (declare (obsolete ghub-post "4.3.1")) (ghub-request "POST" resource params :forge 'bitbucket :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -95,6 +98,7 @@ and `bitbucket' as FORGE." "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"DELETE\" as METHOD and `bitbucket' as FORGE." + (declare (obsolete ghub-delete "4.3.1")) (ghub-request "DELETE" resource params :forge 'bitbucket :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -109,6 +113,7 @@ and `bitbucket' as FORGE." callback errorback extra) "Make a request for RESOURCE and return the response body. Like calling `ghub-request' (which see) with `bitbucket' as FORGE." + (declare (obsolete ghub-request "4.3.1")) (ghub-request method resource params :forge 'bitbucket :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -119,8 +124,8 @@ Like calling `ghub-request' (which see) with `bitbucket' as FORGE." (cl-defun buck-repository-id (owner name &key username auth host) "Return the id of the repository specified by OWNER, NAME and HOST." (substring (cdr (assq 'uuid - (buck-get (format "/repositories/%s/%s" owner name) - nil + (ghub-get (format "/repositories/%s/%s" owner name) + nil :forge 'bitbucket :username username :auth auth :host host))) 1 -1)) diff --git a/elpa/ghub-20241208.2219/dir b/elpa/ghub-20250509.1440/dir similarity index 100% rename from elpa/ghub-20241208.2219/dir rename to elpa/ghub-20250509.1440/dir diff --git a/elpa/ghub-20241208.2219/ghub-autoloads.el b/elpa/ghub-20250509.1440/ghub-autoloads.el similarity index 100% rename from elpa/ghub-20241208.2219/ghub-autoloads.el rename to elpa/ghub-20250509.1440/ghub-autoloads.el diff --git a/elpa/ghub-20241208.2219/ghub-graphql.el b/elpa/ghub-20250509.1440/ghub-graphql.el similarity index 83% rename from elpa/ghub-20241208.2219/ghub-graphql.el rename to elpa/ghub-20250509.1440/ghub-graphql.el index 3e3cd114..a4ffb7db 100644 --- a/elpa/ghub-20241208.2219/ghub-graphql.el +++ b/elpa/ghub-20250509.1440/ghub-graphql.el @@ -1,6 +1,6 @@ -;;; ghub-graphql.el --- Access Github API using GrapthQL -*- lexical-binding:t -*- +;;; ghub-graphql.el --- Access Github API using GraphQL -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub @@ -21,30 +21,37 @@ ;; You should have received a copy of the GNU General Public License ;; along with this file. If not, see . +;;; Commentary: + +;; This library implements GraphQL queries for Github. + ;;; Code: (require 'ghub) (require 'gsexp) (require 'treepy) -;; Needed for Emacs < 27. -(eval-when-compile (require 'json)) -(declare-function json-read-from-string "json" (string)) -(declare-function json-encode "json" (object)) - -(eval-when-compile (require 'pp)) ; Needed for Emacs < 29. (eval-when-compile (require 'subr-x)) -;;; Api - (define-error 'ghub-graphql-error "GraphQL Error" 'ghub-error) +;;; Settings + +(defvar ghub-graphql-message-progress nil + "Whether to show \"Fetching page N...\" in echo area during requests. +By default this information is only shown in the mode-line of the buffer +from which the request was initiated, and if you kill that buffer, then +nowhere. That may make it desirable to display the same message in the +echo area as well.") + (defvar ghub-graphql-items-per-request 50 "Number of GraphQL items to query for entities that return a collection. Adjust this value if you're hitting query timeouts against larger repositories.") +;;; Mutations + (cl-defun ghub-graphql (graphql &optional variables &key username auth host forge @@ -70,6 +77,23 @@ behave as for `ghub-request' (which see)." :callback callback :errorback errorback :extra extra :value value)) +(cl-defun ghub--graphql (graphql + &optional variables + &key username auth host forge + headers + callback errorback) + "An experimental and unfinished replacement for `ghub-graphql'." + (let ((ghub-graphql-message-progress nil)) + (ghub--graphql-vacuum graphql variables callback nil + :username username + :auth auth + :host host + :forge forge + :headers headers + :errorback errorback))) + +;;; Queries + (cl-defun ghub-graphql-rate-limit (&key username auth host) "Return rate limit information." (let-alist (ghub-graphql @@ -77,19 +101,6 @@ behave as for `ghub-request' (which see)." nil :username username :auth auth :host host) .data.rateLimit)) -(cl-defun ghub--repository-id (owner name &key username auth host) - "Return the id of the repository specified by OWNER, NAME and HOST." - (let-alist (ghub-graphql - '(query (repository [(owner $owner String!) - (name $name String!)] - id)) - `((owner . ,owner) - (name . ,name)) - :username username :auth auth :host host) - .data.repository.id)) - -;;; Api (drafts) - (defconst ghub-fetch-repository-sparse '(query (repository @@ -109,6 +120,7 @@ behave as for `ghub-request' (which see)." isLocked isMirror isPrivate + hasDiscussionsEnabled hasIssuesEnabled hasWikiEnabled (licenseInfo name) @@ -123,6 +135,46 @@ behave as for `ghub-request' (which see)." id login name) + (discussionCategories [(:edges t)] + id + name + emoji + isAnswerable + description) + (discussions [(:edges t) + (:singular discussion number) + (orderBy ((field UPDATED_AT) (direction DESC)))] + id + databaseId + number + url + stateReason + ;; Discussions lack isReadByViewer. + (answer id) + (author login) + title + createdAt + updatedAt + closedAt + locked + (category id) + body + (comments [(:edges t)] + id + databaseId + (author login) + createdAt + updatedAt + body + (replies [(:edges 20)] + id + databaseId + (author login) + createdAt + updatedAt + body)) + (labels [(:edges t)] + id)) (issues [(:edges t) (:singular issue number) (orderBy ((field UPDATED_AT) (direction DESC)))] @@ -256,6 +308,27 @@ data as the only argument." :paginate paginate :errorback errorback)) +(cl-defun ghub-fetch-discussion ( owner name number callback + &optional until + &key username auth host forge + headers errorback) + "Asynchronously fetch forge data about the specified discussion. +Once all data has been collected, CALLBACK is called with the +data as the only argument." + (ghub--graphql-vacuum (ghub--graphql-prepare-query + ghub-fetch-repository + `(repository discussions (discussion . ,number))) + `((owner . ,owner) + (name . ,name)) + callback until + :narrow '(repository discussion) + :username username + :auth auth + :host host + :forge forge + :headers headers + :errorback errorback)) + (cl-defun ghub-fetch-issue ( owner name number callback &optional until &key username auth host forge @@ -324,9 +397,6 @@ data as the only argument." ;;; Internal -(defvar ghub--graphql-debug nil - "Whether `ghub--graphql-retrieve' updates the \" *gsexp-encode*\" buffer.") - (cl-defstruct (ghub--graphql-req (:include ghub--req) (:constructor ghub--make-graphql-req) @@ -390,6 +460,9 @@ See Info node `(ghub)GraphQL Support'." (cl-defun ghub--graphql-retrieve (req &optional lineage cursor) (let ((p (cl-incf (ghub--graphql-req-pages req)))) + (when ghub-graphql-message-progress + (let ((message-log-max nil)) + (message "Fetching page %s..." p))) (when (> p 1) (ghub--graphql-set-mode-line req "Fetching page %s" p))) (setf (ghub--graphql-req-query-str req) @@ -397,10 +470,13 @@ See Info node `(ghub)GraphQL Support'." (ghub--graphql-prepare-query (ghub--graphql-req-query req) lineage cursor))) - (when ghub--graphql-debug + (when ghub-debug (with-current-buffer (get-buffer-create " *gsexp-encode*") (erase-buffer) - (insert (ghub--graphql-req-query-str req)))) + (insert (ghub--graphql-req-query-str req) "\n\n") + (let ((pos (point))) + (insert (ghub--encode-payload (ghub--graphql-req-variables req)) "\n") + (ignore-errors (json-pretty-print pos (point)))))) (ghub--retrieve (let ((json-false nil)) (ghub--encode-payload @@ -464,11 +540,15 @@ See Info node `(ghub)GraphQL Support'." (err (plist-get status :error)) (errors (cdr (assq 'errors payload))) (errors (and errors (cons 'ghub-graphql-error errors)))) - (if (or err errors) - (ghub--graphql-handle-failure - req (or err errors) headers status) - (ghub--graphql-walk-response req (assq 'data payload))))) - (when (buffer-live-p buf) + (cond ((or err errors) + (when (and (not err) ghub-debug) + (ignore-errors (json-pretty-print (point) (point-max))) + (pop-to-buffer buf)) + (ghub--graphql-handle-failure + req (or err errors) headers status)) + ((ghub--graphql-walk-response req (assq 'data payload)))))) + (when (and (buffer-live-p buf) + (not (buffer-local-value 'ghub-debug buf))) (kill-buffer buf))))) (defun ghub--graphql-handle-failure (req errors headers status) @@ -594,7 +674,7 @@ See Info node `(ghub)GraphQL Support'." child)))))) (defun ghub--alist-zip (root) - (let ((branchp (lambda (elt) (and (listp elt) (listp (cdr elt))))) + (let ((branchp (##and (listp %) (listp (cdr %)))) (make-node (lambda (_ children) children))) (treepy-zipper branchp #'identity make-node root))) @@ -607,9 +687,19 @@ See Info node `(ghub)GraphQL Support'." (force-mode-line-update t))))) (defun ghub--graphql-pp-response (data) - (require 'pp) ; needed for Emacs < 29. (pp-display-expression data "*Pp Eval Output*")) +(cl-defun ghub--repository-id (owner name &key username auth host) + "Return the id of the repository specified by OWNER, NAME and HOST." + (let-alist (ghub-graphql + '(query (repository [(owner $owner String!) + (name $name String!)] + id)) + `((owner . ,owner) + (name . ,name)) + :username username :auth auth :host host) + .data.repository.id)) + ;;; _ (provide 'ghub-graphql) ;;; ghub-graphql.el ends here diff --git a/elpa/ghub-20241208.2219/ghub-pkg.el b/elpa/ghub-20250509.1440/ghub-pkg.el similarity index 68% rename from elpa/ghub-20241208.2219/ghub-pkg.el rename to elpa/ghub-20250509.1440/ghub-pkg.el index 44d4c951..1c10d3a2 100644 --- a/elpa/ghub-20241208.2219/ghub-pkg.el +++ b/elpa/ghub-20250509.1440/ghub-pkg.el @@ -1,13 +1,14 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "ghub" "20241208.2219" +(define-package "ghub" "20250509.1440" "Client libraries for Git forge APIs." '((emacs "29.1") - (compat "30.0.0.0") + (compat "30.1.0.0") (let-alist "1.0.6") + (llama "0.6.2") (treepy "0.1.2")) :url "https://github.com/magit/ghub" - :commit "97edaf450ef74f40e6c0bd6a35ebd3fcb710ca4d" - :revdesc "97edaf450ef7" + :commit "6bb612e7b7eada22569d84cc529f4ca36e08032d" + :revdesc "6bb612e7b7ea" :keywords '("tools") :authors '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev")) :maintainers '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev"))) diff --git a/elpa/ghub-20241208.2219/ghub.el b/elpa/ghub-20250509.1440/ghub.el similarity index 87% rename from elpa/ghub-20241208.2219/ghub.el rename to elpa/ghub-20250509.1440/ghub.el index 69572fd7..f56484ef 100644 --- a/elpa/ghub-20241208.2219/ghub.el +++ b/elpa/ghub-20250509.1440/ghub.el @@ -1,17 +1,18 @@ ;;; ghub.el --- Client libraries for Git forge APIs -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub ;; Keywords: tools -;; Package-Version: 20241208.2219 -;; Package-Revision: 97edaf450ef7 +;; Package-Version: 20250509.1440 +;; Package-Revision: 6bb612e7b7ea ;; Package-Requires: ( ;; (emacs "29.1") -;; (compat "30.0.0.0") +;; (compat "30.1.0.0") ;; (let-alist "1.0.6") +;; (llama "0.6.2") ;; (treepy "0.1.2")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -63,17 +64,13 @@ (require 'compat) (require 'gnutls) (require 'let-alist) +(require 'llama) (require 'url) (require 'url-auth) (require 'url-http) (eval-when-compile (require 'subr-x)) -;; Needed for Emacs < 27. -(eval-when-compile (require 'json)) -(declare-function json-read-from-string "json" (string)) -(declare-function json-encode "json" (object)) - (declare-function glab-repository-id "glab" (owner name &key username auth host)) (declare-function gtea-repository-id "gtea" (owner name &key username auth host)) (declare-function gogs-repository-id "gogs" (owner name &key username auth host)) @@ -99,18 +96,8 @@ only serves as documentation.") (defvar ghub-insecure-hosts nil "List of hosts that use http instead of https.") -(defvar ghub-json-use-jansson nil - "Whether to use the Jansson library, if available. -This is experimental. Only let-bind this but do not enable it -globally because doing that is likely to break other packages -that use `ghub'. As a user also do not enable this yet. -See https://github.com/magit/ghub/pull/149.") - -(defvar ghub-json-object-type 'alist - "The object type that is used for json payload decoding.") - -(defvar ghub-json-array-type 'list - "The array type that is used for json payload decoding.") +(defvar ghub-debug nil + "Record additional debug information.") ;;; Request ;;;; Object @@ -446,10 +433,8 @@ to the value of `ghub-response-headers', for later use when this function is called with nil for PAYLOAD." (if (eq (ghub--req-forge req) 'bitbucket) (if payload - (let* ((page (mapcan (lambda (key) - (and-let* ((elt (assq key payload))) - (list elt))) - '(size page pagelen next previous))) + (let* ((page (seq-keep (##assq % payload) + '(size page pagelen next previous))) (headers (cons (cons 'link-alist page) headers))) (if (and req (or (ghub--req-callback req) (ghub--req-errorback req))) @@ -464,7 +449,7 @@ this function is called with nil for PAYLOAD." (pcase-let ((`(,url ,rel) (split-string elt "; "))) (cons (intern (substring rel 5 -1)) (substring url 1 -1)))) - (split-string rels ", "))))) + (split-string rels ", ?"))))) (cl-defun ghub-repository-id (owner name &key username auth host forge noerror) "Return the id of the specified repository. @@ -546,7 +531,8 @@ Signal an error if the id cannot be determined." (set-buffer req-buf)) (funcall callback value headers status req))) (t value)))))) - (when (buffer-live-p buf) + (when (and (buffer-live-p buf) + (not (buffer-local-value 'ghub-debug buf))) (kill-buffer buf))))) (defun ghub--handle-response-headers (_status req) @@ -608,34 +594,27 @@ Signal an error if the id cannot be determined." 'ghub--read-json-payload) url-http-response-status)) -(defun ghub--read-json-payload (_status) - (let ((raw (ghub--decode-payload))) - (and raw - (condition-case nil - (if (and ghub-json-use-jansson - (fboundp 'json-parse-string)) - (json-parse-string - raw - :object-type ghub-json-object-type - :array-type ghub-json-array-type - :false-object nil - :null-object nil) - (require 'json) - (let ((json-object-type ghub-json-object-type) - (json-array-type ghub-json-array-type) - (json-false nil) - (json-null nil)) - (json-read-from-string raw))) - ((json-parse-error json-readtable-error) - `((message - . ,(if (looking-at "") - (if (re-search-forward - "

\\(?:\\)?\\([^<]+\\)" nil t) - (match-string 1) - "error description missing") - (string-trim (buffer-substring (point) (point-max))))) - (documentation_url - . "https://github.com/magit/ghub/wiki/Github-Errors"))))))) +(defun ghub--read-json-payload (_status &optional json-type-args) + (and-let* ((payload (ghub--decode-payload))) + (ghub--assert-json-available) + (condition-case nil + (apply #'json-parse-string payload + (or json-type-args + '( :object-type alist + :array-type list + :null-object nil + :false-object nil))) + (json-parse-error + (pop-to-buffer (current-buffer)) + (setq-local ghub-debug t) + `((message . ,(if (looking-at "") + (if (re-search-forward + "

\\(?:\\)?\\([^<]+\\)" nil t) + (match-string 1) + "error description missing") + (string-trim (buffer-substring (point) (point-max))))) + (documentation_url + . "https://github.com/magit/ghub/wiki/Github-Errors")))))) (defun ghub--decode-payload (&optional _status) (and (not (eobp)) @@ -644,27 +623,15 @@ Signal an error if the id cannot be determined." 'utf-8))) (defun ghub--encode-payload (payload) - (and payload - (progn - (unless (stringp payload) - (setq payload - (if (and ghub-json-use-jansson - (fboundp 'json-serialize)) - (json-serialize payload - ;; :object-type and :array-type - ;; are not supported here. - :false-object nil - :null-object :null) - (require 'json) - (let ((json-object-type ghub-json-object-type) - (json-array-type ghub-json-array-type) - (json-false nil) - (json-null :null)) - ;; Unfortunately `json-encode' may modify the input. - ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40693. - ;; and https://github.com/magit/forge/issues/267 - (json-encode (copy-tree payload)))))) - (encode-coding-string payload 'utf-8)))) + (cl-typecase payload + (null nil) + (string (encode-coding-string payload 'utf-8)) + (t (ghub--assert-json-available) + (encode-coding-string + (json-serialize payload + :null-object :null + :false-object nil) + 'utf-8)))) (defun ghub--url-encode-params (params) (mapconcat (lambda (param) @@ -676,6 +643,11 @@ Signal an error if the id cannot be determined." (t (url-hexify-string val)))))) params "&")) +(defun ghub--assert-json-available () + (unless (and (fboundp 'json-available-p) + (json-available-p)) + (error "Ghub requires Emacs 29 --with-json or Emacs >= 30"))) + ;;; Authentication ;;;; API @@ -754,25 +726,22 @@ and call `auth-source-forget+'." (defun ghub--token (host username package &optional nocreate forge) (let* ((user (ghub--ident username package)) - (token - (or (car (ghub--auth-source-get (list :secret) - :host host :user user)) - (progn - ;; Auth-Source caches the information that there is no - ;; value, but in our case that is a situation that needs - ;; fixing so we want to keep trying by invalidating that - ;; information. - ;; The (:max 1) is needed and has to be placed at the - ;; end for Emacs releases before 26.1. #24 #64 #72 - (auth-source-forget (list :host host :user user :max 1)) - (and (not nocreate) - (error "\ -Required %s token (\"%s\" for \"%s\") does not exist. + (token (or (ghub--auth-source-get :secret :host host :user user) + (and (string-match "\\`\\([^/]+\\)" host) + (ghub--auth-source-get :secret + :host (match-string 1 host) + :user user))))) + (unless (or token nocreate) + (error "\ +Required %s token (%S for %s%S) does not exist. See https://magit.vc/manual/ghub/Getting-Started.html -or (info \"(ghub)Getting Started\") for instructions. -\(The setup wizard no longer exists.)" - (capitalize (symbol-name (or forge 'github))) - user host)))))) +or (info \"(ghub)Getting Started\") for instructions." + (capitalize (symbol-name (or forge 'github))) + user + (if (string-match "\\`\\([^/]+\\)" host) + (format "either %S or " (match-string 1 host)) + "") + host)) (if (functionp token) (funcall token) token))) (cl-defgeneric ghub--host (&optional forge) @@ -840,11 +809,16 @@ or (info \"(ghub)Getting Started\") for instructions. (defun ghub--auth-source-get (keys &rest spec) (declare (indent 1)) - (let ((plist (car (apply #'auth-source-search - (append spec (list :max 1)))))) - (mapcar (lambda (k) - (plist-get plist k)) - keys))) + (if-let ((plist (car (apply #'auth-source-search + (append spec (list :max 1)))))) + (if (keywordp keys) + (plist-get plist keys) + (mapcar (##plist-get plist %) keys)) + ;; Auth-Source caches the information that there is no value, but in + ;; our case that is a situation that needs fixing, so we want to keep + ;; trying, by invalidating that information. + (auth-source-forget spec) + nil)) ;;; _ (provide 'ghub) diff --git a/elpa/ghub-20241208.2219/ghub.info b/elpa/ghub-20250509.1440/ghub.info similarity index 97% rename from elpa/ghub-20241208.2219/ghub.info rename to elpa/ghub-20250509.1440/ghub.info index dc9830dc..93914b6e 100644 --- a/elpa/ghub-20241208.2219/ghub.info +++ b/elpa/ghub-20250509.1440/ghub.info @@ -1,6 +1,6 @@ This is ghub.info, produced by makeinfo version 6.8 from ghub.texi. - Copyright (C) 2017-2024 Jonas Bernoulli + Copyright (C) 2017-2025 Jonas Bernoulli You can redistribute this document and/or modify it under the terms @@ -27,9 +27,9 @@ Ghub User and Developer Manual Ghub is an Emacs library that is used by various packages to access the APIs of various instances of various Git forge implementations. -This manual is for Ghub version 4.2.0. +This manual is for Ghub version 4.3.1. - Copyright (C) 2017-2024 Jonas Bernoulli + Copyright (C) 2017-2025 Jonas Bernoulli You can redistribute this document and/or modify it under the terms @@ -60,12 +60,6 @@ Getting Started * Creating and Storing a Token:: * Github Configuration Variables:: -Creating and Storing a Token - -* Creating a Token:: -* Storing a Token:: - - API * Their APIs:: @@ -296,14 +290,6 @@ File: ghub.info, Node: Creating and Storing a Token, Next: Github Configuratio 2.3 Creating and Storing a Token ================================ -* Menu: - -* Creating a Token:: -* Storing a Token:: - - -File: ghub.info, Node: Creating a Token, Next: Storing a Token, Up: Creating and Storing a Token - 2.3.1 Creating a Token ---------------------- @@ -326,9 +312,6 @@ should consult the documentation of that package, which in turn should tell you which scopes are needed and why. The Forge package for example does so in *note (forge)Token Creation::. - -File: ghub.info, Node: Storing a Token, Prev: Creating a Token, Up: Creating and Storing a Token - 2.3.2 Storing a Token --------------------- @@ -1129,30 +1112,30 @@ Appendix B Variable Index  Tag Table: Node: Top773 -Node: Introduction2316 -Node: Getting Started2721 -Node: Basic Concepts Arguments and Variables3748 -Node: Setting the Username7728 -Ref: Setting your Githubcom Username8216 -Ref: Setting your Gitlabcom Username8572 -Ref: Setting your Github Enterprise Username9038 -Ref: Setting your Username for Other Hosts and/or Forges9771 -Node: Creating and Storing a Token10577 -Node: Creating a Token10841 -Node: Storing a Token11855 -Node: Github Configuration Variables13701 -Node: API15412 -Node: Their APIs15650 -Node: Making REST Requests16375 -Node: Making GraphQL Requests25788 -Node: Github Convenience Wrappers32471 -Node: Non-Github Convenience Wrappers36175 -Node: Notes41679 -Node: Using Ghub in Personal Scripts41886 -Node: Using Ghub in Your Own Package42777 -Node: Forge Limitations and Notes43712 -Node: Function Index44685 -Node: Variable Index50334 +Node: Introduction2243 +Node: Getting Started2648 +Node: Basic Concepts Arguments and Variables3675 +Node: Setting the Username7655 +Ref: Setting your Githubcom Username8143 +Ref: Setting your Gitlabcom Username8499 +Ref: Setting your Github Enterprise Username8965 +Ref: Setting your Username for Other Hosts and/or Forges9698 +Node: Creating and Storing a Token10504 +Ref: Creating a Token10717 +Ref: Storing a Token11628 +Node: Github Configuration Variables13371 +Node: API15082 +Node: Their APIs15320 +Node: Making REST Requests16045 +Node: Making GraphQL Requests25458 +Node: Github Convenience Wrappers32141 +Node: Non-Github Convenience Wrappers35845 +Node: Notes41349 +Node: Using Ghub in Personal Scripts41556 +Node: Using Ghub in Your Own Package42447 +Node: Forge Limitations and Notes43382 +Node: Function Index44355 +Node: Variable Index50004  End Tag Table diff --git a/elpa/ghub-20241208.2219/glab.el b/elpa/ghub-20250509.1440/glab.el similarity index 99% rename from elpa/ghub-20241208.2219/glab.el rename to elpa/ghub-20250509.1440/glab.el index 04e6ea1b..8f9f408e 100644 --- a/elpa/ghub-20241208.2219/glab.el +++ b/elpa/ghub-20250509.1440/glab.el @@ -1,6 +1,6 @@ ;;; glab.el --- Client library for the Gitlab API -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub diff --git a/elpa/ghub-20241208.2219/gogs.el b/elpa/ghub-20250509.1440/gogs.el similarity index 93% rename from elpa/ghub-20241208.2219/gogs.el rename to elpa/ghub-20250509.1440/gogs.el index c34f938a..e3378787 100644 --- a/elpa/ghub-20241208.2219/gogs.el +++ b/elpa/ghub-20250509.1440/gogs.el @@ -1,6 +1,6 @@ ;;; gogs.el --- Client library for the Gogs API -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub @@ -49,6 +49,7 @@ "Make a `GET' request for RESOURCE, with optional query PARAMS. Like calling `ghub-request' (which see) with \"GET\" as METHOD and `gogs' as FORGE." + (declare (obsolete ghub-get "4.3.1")) (ghub-request "GET" resource params :forge 'gogs :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -64,6 +65,7 @@ and `gogs' as FORGE." "Make a `PUT' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PUT\" as METHOD and `gogs' as FORGE." + (declare (obsolete ghub-put "4.3.1")) (ghub-request "PUT" resource params :forge 'gogs :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -79,6 +81,7 @@ and `gogs' as FORGE." "Make a `POST' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"POST\" as METHOD and `gogs' as FORGE." + (declare (obsolete ghub-post "4.3.1")) (ghub-request "POST" resource params :forge 'gogs :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -94,6 +97,7 @@ and `gogs' as FORGE." "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PATCH\" as METHOD and `gogs' as FORGE." + (declare (obsolete ghub-patch "4.3.1")) (ghub-request "PATCH" resource params :forge 'gogs :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -109,6 +113,7 @@ and `gogs' as FORGE." "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"DELETE\" as METHOD and `gogs' as FORGE." + (declare (obsolete ghub-delete "4.3.1")) (ghub-request "DELETE" resource params :forge 'gogs :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -123,6 +128,7 @@ and `gogs' as FORGE." callback errorback extra) "Make a request for RESOURCE and return the response body. Like calling `ghub-request' (which see) with `gogs' as FORGE." + (declare (obsolete ghub-request "4.3.1")) (ghub-request method resource params :forge 'gogs :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -133,8 +139,9 @@ Like calling `ghub-request' (which see) with `gogs' as FORGE." (cl-defun gogs-repository-id (owner name &key username auth host) "Return the id of the repository specified by OWNER, NAME and HOST." (number-to-string - (cdr (assq 'id (gogs-get (format "/repos/%s/%s" owner name) - nil :username username :auth auth :host host))))) + (cdr (assq 'id (ghub-get (format "/repos/%s/%s" owner name) + nil :forge 'gogs + :username username :auth auth :host host))))) ;;; _ (provide 'gogs) diff --git a/elpa/ghub-20241208.2219/gsexp.el b/elpa/ghub-20250509.1440/gsexp.el similarity index 98% rename from elpa/ghub-20241208.2219/gsexp.el rename to elpa/ghub-20250509.1440/gsexp.el index 0ede22a6..a1fac790 100644 --- a/elpa/ghub-20241208.2219/gsexp.el +++ b/elpa/ghub-20250509.1440/gsexp.el @@ -1,6 +1,6 @@ ;;; gsexp.el --- GraphQl as S-expressions -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub diff --git a/elpa/ghub-20241208.2219/gtea.el b/elpa/ghub-20250509.1440/gtea.el similarity index 93% rename from elpa/ghub-20241208.2219/gtea.el rename to elpa/ghub-20250509.1440/gtea.el index e7c0292f..4728c04f 100644 --- a/elpa/ghub-20241208.2219/gtea.el +++ b/elpa/ghub-20250509.1440/gtea.el @@ -1,6 +1,6 @@ ;;; gtea.el --- Client library for the Gitea API -*- lexical-binding:t -*- -;; Copyright (C) 2016-2024 Jonas Bernoulli +;; Copyright (C) 2016-2025 Jonas Bernoulli ;; Author: Jonas Bernoulli ;; Homepage: https://github.com/magit/ghub @@ -49,6 +49,7 @@ "Make a `GET' request for RESOURCE, with optional query PARAMS. Like calling `ghub-request' (which see) with \"GET\" as METHOD and `gitea' as FORGE." + (declare (obsolete ghub-get "4.3.1")) (ghub-request "GET" resource params :forge 'gitea :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -64,6 +65,7 @@ and `gitea' as FORGE." "Make a `PUT' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PUT\" as METHOD and `gitea' as FORGE." + (declare (obsolete ghub-put "4.3.1")) (ghub-request "PUT" resource params :forge 'gitea :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -79,6 +81,7 @@ and `gitea' as FORGE." "Make a `POST' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"POST\" as METHOD and `gitea' as FORGE." + (declare (obsolete ghub-post "4.3.1")) (ghub-request "POST" resource params :forge 'gitea :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -94,6 +97,7 @@ and `gitea' as FORGE." "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PATCH\" as METHOD and `gitea' as FORGE." + (declare (obsolete ghub-patch "4.3.1")) (ghub-request "PATCH" resource params :forge 'gitea :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -109,6 +113,7 @@ and `gitea' as FORGE." "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"DELETE\" as METHOD and `gitea' as FORGE." + (declare (obsolete ghub-delete "4.3.1")) (ghub-request "DELETE" resource params :forge 'gitea :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -123,6 +128,7 @@ and `gitea' as FORGE." callback errorback extra) "Make a request for RESOURCE and return the response body. Like calling `ghub-request' (which see) with `gitea' as FORGE." + (declare (obsolete ghub-request "4.3.1")) (ghub-request method resource params :forge 'gitea :query query :payload payload :headers headers :silent silent :unpaginate unpaginate @@ -133,8 +139,9 @@ Like calling `ghub-request' (which see) with `gitea' as FORGE." (cl-defun gtea-repository-id (owner name &key username auth host) "Return the id of the repository specified by OWNER, NAME and HOST." (number-to-string - (cdr (assq 'id (gtea-get (format "/repos/%s/%s" owner name) - nil :username username :auth auth :host host))))) + (cdr (assq 'id (ghub-get (format "/repos/%s/%s" owner name) + nil :forge 'gitea + :username username :auth auth :host host))))) ;;; _ (provide 'gtea) -- 2.47.3