From 21c4db70ed00e79d648e68a5ead000f21f163a6c Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 24 Dec 2025 13:42:09 +0100 Subject: [PATCH] update ghub --- elpa/ghub-20250509.1440/buck.el | 134 ---- elpa/ghub-20250509.1440/ghub-graphql.el | 705 ------------------ elpa/ghub-20250509.1440/glab.el | 168 ----- elpa/ghub-20250509.1440/gogs.el | 148 ---- elpa/ghub-20250509.1440/gtea.el | 148 ---- .../.dir-locals.el | 0 .../dir | 0 .../ghub-autoloads.el | 21 +- elpa/ghub-20251130.1842/ghub-graphql.el | 352 +++++++++ elpa/ghub-20251130.1842/ghub-legacy.el | 377 ++++++++++ .../ghub-pkg.el | 16 +- .../ghub.el | 388 +++++----- .../ghub.info | 274 ++----- .../gsexp.el | 0 14 files changed, 992 insertions(+), 1739 deletions(-) delete mode 100644 elpa/ghub-20250509.1440/buck.el delete mode 100644 elpa/ghub-20250509.1440/ghub-graphql.el delete mode 100644 elpa/ghub-20250509.1440/glab.el delete mode 100644 elpa/ghub-20250509.1440/gogs.el delete mode 100644 elpa/ghub-20250509.1440/gtea.el rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/.dir-locals.el (100%) rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/dir (100%) rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/ghub-autoloads.el (71%) create mode 100644 elpa/ghub-20251130.1842/ghub-graphql.el create mode 100644 elpa/ghub-20251130.1842/ghub-legacy.el rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/ghub-pkg.el (55%) rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/ghub.el (75%) rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/ghub.info (77%) rename elpa/{ghub-20250509.1440 => ghub-20251130.1842}/gsexp.el (100%) diff --git a/elpa/ghub-20250509.1440/buck.el b/elpa/ghub-20250509.1440/buck.el deleted file mode 100644 index 0a56a10f..00000000 --- a/elpa/ghub-20250509.1440/buck.el +++ /dev/null @@ -1,134 +0,0 @@ -;;; buck.el --- Client library for the Bitbucket API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2025 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Buck is a library that provides basic support for using the Bitbucket API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Buck does -;; not support the guided creation of tokens because Bitbucket lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst buck-default-host "api.bitbucket.org/2.0" - "The default host that is used if `buck.host' is not set.") - -;; HEAD and PATCH are not supported according to -;; https://developer.atlassian.com/bitbucket/api/2/reference/meta/uri-uuid - -(cl-defun buck-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - 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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(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 - (ghub-get (format "/repositories/%s/%s" owner name) - nil :forge 'bitbucket - :username username :auth auth :host host))) - 1 -1)) - -;;; _ -(provide 'buck) -;;; buck.el ends here diff --git a/elpa/ghub-20250509.1440/ghub-graphql.el b/elpa/ghub-20250509.1440/ghub-graphql.el deleted file mode 100644 index a4ffb7db..00000000 --- a/elpa/ghub-20250509.1440/ghub-graphql.el +++ /dev/null @@ -1,705 +0,0 @@ -;;; ghub-graphql.el --- Access Github API using GraphQL -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2025 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; 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) - -(eval-when-compile (require 'subr-x)) - -(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 - headers silent - callback errorback value extra) - "Make a GraphQL request using GRAPHQL and VARIABLES. -Return the response as a JSON-like alist. Even if the response -contains `errors', do not raise an error. GRAPHQL is a GraphQL -string. VARIABLES is a JSON-like alist. The other arguments -behave as for `ghub-request' (which see)." - (cl-assert (not (stringp variables))) - (cl-assert (or (stringp graphql) - (memq (car-safe graphql) '(query mutation)))) - (unless (stringp graphql) - (setq graphql (gsexp-encode (ghub--graphql-prepare-query graphql)))) - (ghub-request "POST" - (if (eq forge 'gitlab) "/api/graphql" "/graphql") - nil - :payload `((query . ,graphql) - ,@(and variables `((variables ,@variables)))) - :headers headers :silent silent - :username username :auth auth :host host :forge forge - :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 - '(query (rateLimit limit cost remaining resetAt)) - nil :username username :auth auth :host host) - .data.rateLimit)) - -(defconst ghub-fetch-repository-sparse - '(query - (repository - [(owner $owner String!) - (name $name String!)] - name - id - createdAt - updatedAt - nameWithOwner - (parent nameWithOwner) - description - homepageUrl - (defaultBranchRef name) - isArchived - isFork - isLocked - isMirror - isPrivate - hasDiscussionsEnabled - hasIssuesEnabled - hasWikiEnabled - (licenseInfo name) - (stargazers totalCount) - (watchers totalCount)))) - -(defconst ghub-fetch-repository - `(query - (repository - ,@(cdr (cadr ghub-fetch-repository-sparse)) - (assignableUsers [(:edges t)] - 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)))] - number - id - state - stateReason - isReadByViewer - (author login) - title - createdAt - updatedAt - closedAt - locked - (milestone id) - body - (assignees [(:edges t)] - id) - (comments [(:edges t)] - id - databaseId - (author login) - createdAt - updatedAt - body) - (labels [(:edges t)] - id)) - (labels [(:edges t) - (:singular label id)] - id - name - color - description) - (milestones [(:edges t) - (:singular milestone id)] - id - number - title - createdAt - updatedAt - dueOn - closedAt - description) - (pullRequests [(:edges t) - (:singular pullRequest number) - (orderBy ((field UPDATED_AT) (direction DESC)))] - number - id - state - isReadByViewer - (author login) - title - createdAt - updatedAt - closedAt - mergedAt - isDraft - locked - maintainerCanModify - isCrossRepository - (milestone id) - body - (baseRef name - (repository nameWithOwner)) - baseRefOid - (headRef name - (repository (owner login) - nameWithOwner)) - headRefOid - (assignees [(:edges t)] - id) - (reviewRequests [(:edges t)] - (requestedReviewer "... on User { id }\n")) - (comments [(:edges t)] - id - databaseId - (author login) - createdAt - updatedAt - body) - (labels [(:edges t)] - id))))) - -(defconst ghub-fetch-repository-review-threads - '(query - (repository - [(owner $owner String!) - (name $name String!)] - (pullRequests [(:edges t) - (:singular pullRequest number) - (orderBy ((field UPDATED_AT) (direction DESC)))] - number - baseRefOid - headRefOid - (reviewThreads [(:edges t)] - id - line - originalLine - diffSide - (resolvedBy login) - (comments [(:edges t)] - id - databaseId - (author login) - createdAt - updatedAt - body - (replyTo databaseId) - (originalCommit oid) - path)))))) - -(cl-defun ghub-fetch-repository ( owner name callback - &optional until - &key username auth host forge - headers paginate errorback sparse) - "Asynchronously fetch forge data about the specified repository. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (if sparse - ghub-fetch-repository-sparse - ghub-fetch-repository) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository) - :username username - :auth auth - :host host - :forge forge - :headers headers - :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 - headers paginate errorback) - "Asynchronously fetch forge data about the specified issue. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (ghub--graphql-narrow-query - ghub-fetch-repository - `(repository issues (issue . ,number))) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository issue) - :username username - :auth auth - :host host - :forge forge - :headers headers - :paginate paginate - :errorback errorback)) - -(cl-defun ghub-fetch-pullreq ( owner name number callback - &optional until - &key username auth host forge - headers paginate errorback) - "Asynchronously fetch forge data about the specified pull-request. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (ghub--graphql-narrow-query - ghub-fetch-repository - `(repository pullRequests (pullRequest . ,number))) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository pullRequest) - :username username - :auth auth - :host host - :forge forge - :headers headers - :paginate paginate - :errorback errorback)) - -(cl-defun ghub-fetch-review-threads ( owner name number callback - &optional until - &key username auth host forge - headers paginate errorback) - "Asynchronously fetch forge data about the review threads from a pull-request. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (ghub--graphql-narrow-query - ghub-fetch-repository-review-threads - `(repository pullRequests (pullRequest . ,number))) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository pullRequest) - :username username - :auth auth - :host host - :forge forge - :headers headers - :paginate paginate - :errorback errorback)) - -;;; Internal - -(cl-defstruct (ghub--graphql-req - (:include ghub--req) - (:constructor ghub--make-graphql-req) - (:copier nil)) - (query nil :read-only t) - (query-str nil :read-only nil) - (variables nil :read-only t) - (until nil :read-only t) - (pages 0 :read-only nil) - (paginate nil :read-only nil) - (narrow nil :read-only t)) - -(cl-defun ghub--graphql-vacuum ( query variables callback - &optional until - &key narrow username auth host forge - headers paginate errorback) - "Make a GraphQL request using QUERY and VARIABLES. -See Info node `(ghub)GraphQL Support'." - (unless host - (setq host (ghub--host forge))) - (unless (or username (stringp auth) (eq auth 'none)) - (setq username (ghub--username host forge))) - (ghub--graphql-retrieve - (ghub--make-graphql-req - :url (url-generic-parse-url - (format "https://%s/graphql" - (if (string-suffix-p "/v3" host) - (substring host 0 -3) - host))) - :method "POST" - :headers (ghub--headers headers host auth username forge) - :handler #'ghub--graphql-handle-response - :query query - :variables variables - :until until - :buffer (current-buffer) - :narrow narrow - :paginate (or paginate - (and-let* ((p (and (eq auth 'forge) - (fboundp 'magit-get) - (magit-get "forge.graphqlItemLimit")))) - (string-to-number p))) - :callback (and (not (eq callback 'synchronous)) callback) - :errorback (and (not (eq callback 'synchronous)) errorback)))) - -(defvar ghub--graphql-synchronous-value nil) - -(cl-defun ghub--graphql-synchronous ( query variables - &optional until - &key narrow username auth host forge - headers paginate) - "Make a synchronous GraphQL request using QUERY and VARIABLES. -See Info node `(ghub)GraphQL Support'." - (unwind-protect - (progn (ghub--graphql-vacuum query variables 'synchronous until - :narrow narrow :username username - :auth auth :host host :forge forge - :headers headers :paginate paginate) - ghub--graphql-synchronous-value) - (setq ghub--graphql-synchronous-value nil))) - -(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) - (gsexp-encode - (ghub--graphql-prepare-query - (ghub--graphql-req-query req) - lineage cursor))) - (when ghub-debug - (with-current-buffer (get-buffer-create " *gsexp-encode*") - (erase-buffer) - (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 - `((query . ,(ghub--graphql-req-query-str req)) - (variables . ,(ghub--graphql-req-variables req))))) - req)) - -(defun ghub--graphql-prepare-query (query &optional lineage cursor paginate) - (when lineage - (setq query (ghub--graphql-narrow-query query lineage cursor))) - (let ((loc (ghub--alist-zip query)) - variables) - (cl-block nil - (while t - (let ((node (treepy-node loc))) - (when (and (vectorp node) - (listp (aref node 0))) - (let ((alist (cl-coerce node 'list)) - vars) - (when-let ((edges (cadr (assq :edges alist)))) - (push (list 'first - (apply - #'min - (delq nil (list (and (numberp edges) edges) - paginate - ghub-graphql-items-per-request)))) - vars) - (setq loc (treepy-up loc)) - (setq node (treepy-node loc)) - (setq loc (treepy-replace - loc `(,(car node) - ,(cadr node) - (pageInfo endCursor hasNextPage) - (edges (node ,@(cddr node)))))) - (setq loc (treepy-down loc)) - (setq loc (treepy-next loc))) - (dolist (elt alist) - (cond ((keywordp (car elt))) - ((length= elt 3) - (push (list (nth 0 elt) (nth 1 elt)) vars) - (push (list (nth 1 elt) (nth 2 elt)) variables)) - ((length= elt 2) - (push elt vars)))) - (setq loc (treepy-replace loc (vconcat (nreverse vars))))))) - (if (treepy-end-p loc) - (let ((node (copy-sequence (treepy-node loc)))) - (when variables - (push (cl-coerce variables 'vector) - (cdr node))) - (cl-return node)) - (setq loc (treepy-next loc))))))) - -(defun ghub--graphql-handle-response (status req) - (let ((buf (current-buffer))) - (unwind-protect - (progn - (set-buffer-multibyte t) - (let* ((headers (ghub--handle-response-headers status req)) - (payload (ghub--handle-response-payload req)) - (payload (ghub--handle-response-error status payload req)) - (err (plist-get status :error)) - (errors (cdr (assq 'errors payload))) - (errors (and errors (cons 'ghub-graphql-error errors)))) - (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) - (if-let ((errorback (ghub--req-errorback req))) - (let ((buffer (ghub--req-buffer req))) - (with-current-buffer - (if (buffer-live-p buffer) buffer (current-buffer)) - (funcall errorback errors headers status req))) - (ghub--signal-error errors))) - -(defun ghub--graphql-handle-success (req data) - (let ((callback (ghub--req-callback req)) - (buffer (ghub--req-buffer req)) - (narrow (ghub--graphql-req-narrow req))) - (while-let ((key (pop narrow))) - (setq data (cdr (assq key data)))) - (with-current-buffer - (if (buffer-live-p buffer) buffer (current-buffer)) - (funcall (or callback #'ghub--graphql-pp-response) - data)))) - -(defun ghub--graphql-walk-response (req data) - (let* ((loc (ghub--req-value req)) - (loc (if (not loc) - (ghub--alist-zip data) - (setq data (ghub--graphql-narrow-data - data (ghub--graphql-lineage loc))) - (setf (alist-get 'edges data) - (append (alist-get 'edges (treepy-node loc)) - (or (alist-get 'edges data) - (error "BUG: Expected new nodes")))) - (treepy-replace loc data)))) - (cl-block nil - (while t - (when (eq (car-safe (treepy-node loc)) 'edges) - (setq loc (treepy-up loc)) - (pcase-let ((`(,key . ,val) (treepy-node loc))) - (let-alist val - (let* ((cursor (and .pageInfo.hasNextPage - .pageInfo.endCursor)) - (until (cdr (assq (intern (format "%s-until" key)) - (ghub--graphql-req-until req)))) - (nodes (mapcar #'cdar .edges)) - (nodes (if until - (seq-take-while - (lambda (node) - (or (string> (cdr (assq 'updatedAt node)) - until) - (setq cursor nil))) - nodes) - nodes))) - (cond (cursor - (setf (ghub--req-value req) loc) - (ghub--graphql-retrieve req - (ghub--graphql-lineage loc) - cursor) - (cl-return)) - ((setq loc (treepy-replace loc (cons key nodes))))))))) - (cond ((not (treepy-end-p loc)) - (setq loc (treepy-next loc))) - ((ghub--req-callback req) - (ghub--graphql-handle-success req (treepy-root loc)) - (ghub--graphql-set-mode-line req nil) - (cl-return)) - (t - (setq ghub--graphql-synchronous-value (treepy-root loc)) - (cl-return))))))) - -(defun ghub--graphql-lineage (loc) - (let (lineage) - (while (treepy-up loc) - (push (car (treepy-node loc)) lineage) - (setq loc (treepy-up loc))) - lineage)) - -(defun ghub--graphql-narrow-data (data lineage) - (while-let ((key (pop lineage))) - (if (consp (car lineage)) - (progn (pop lineage) - (setf data (cadr data))) - (setq data (assq key (cdr data))))) - data) - -(defun ghub--graphql-narrow-query (query lineage &optional cursor) - (if (consp (car lineage)) - (let* ((child (cddr query)) - (alist (cl-coerce (cadr query) 'list)) - (single (cdr (assq :singular alist)))) - `(,(car single) - ,(vector (list (cadr single) (cdr (car lineage)))) - ,@(if (cdr lineage) - (ghub--graphql-narrow-query child (cdr lineage) cursor) - child))) - (let* ((child (or (assq (car lineage) (cdr query)) - ;; Alias - (cl-find-if (lambda (c) - (eq (car-safe (car-safe c)) - (car lineage))) - query) - ;; Edges - (cl-find-if (lambda (c) - (and (listp c) - (vectorp (cadr c)) - (eq (cadr (assq :singular - (cl-coerce (cadr c) - 'list))) - (car lineage)))) - (cdr query)) - (error "BUG: Failed to narrow query"))) - (object (car query)) - (args (and (vectorp (cadr query)) - (cadr query)))) - `(,object - ,@(and args (list args)) - ,(cond ((cdr lineage) - (ghub--graphql-narrow-query child (cdr lineage) cursor)) - (cursor - `(,(car child) - ,(vconcat `((after ,cursor)) - (cadr child)) - ,@(cddr child))) - (t - child)))))) - -(defun ghub--alist-zip (root) - (let ((branchp (##and (listp %) (listp (cdr %)))) - (make-node (lambda (_ children) children))) - (treepy-zipper branchp #'identity make-node root))) - -(defun ghub--graphql-set-mode-line (req string &rest args) - (let ((buffer (ghub--graphql-req-buffer req))) - (when (buffer-live-p buffer) - (with-current-buffer buffer - (setq mode-line-process - (and string (concat " " (apply #'format string args)))) - (force-mode-line-update t))))) - -(defun ghub--graphql-pp-response (data) - (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-20250509.1440/glab.el b/elpa/ghub-20250509.1440/glab.el deleted file mode 100644 index 8f9f408e..00000000 --- a/elpa/ghub-20250509.1440/glab.el +++ /dev/null @@ -1,168 +0,0 @@ -;;; glab.el --- Client library for the Gitlab API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2025 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Glab is a library that provides basic support for using the Gitlab API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Glab does -;; not support the guided creation of tokens because Gitlab lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst glab-default-host "gitlab.com/api/v4" - "The default host that is used if `glab.host' is not set.") - -(cl-defun glab-head (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `HEAD' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"HEAD\" as METHOD -and `gitlab' as FORGE." - (ghub-request "HEAD" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `GET' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"GET\" as METHOD -and `gitlab' as FORGE." - (ghub-request "GET" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PUT' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PUT\" as METHOD -and `gitlab' as FORGE." - (ghub-request "PUT" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `POST' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"POST\" as METHOD -and `gitlab' as FORGE." - (ghub-request "POST" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PATCH\" as METHOD -and `gitlab' as FORGE." - (ghub-request "PATCH" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"DELETE\" as METHOD -and `gitlab' as FORGE." - (ghub-request "DELETE" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a request for RESOURCE and return the response body. -Like calling `ghub-request' (which see) with `gitlab' as FORGE." - (ghub-request method resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-graphql (graphql &optional variables - &key username auth host - headers silent - callback errorback value extra) - "Make a GraphQL request using GRAPHQL and VARIABLES. -Like calling `ghub-graphql' (which see) with `gitlab' as FORGE." - (ghub-graphql graphql variables :forge 'gitlab - :username username :auth auth :host host - :headers headers :silent silent - :callback callback :errorback errorback - :value value :extra extra)) - -(cl-defun glab-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 (glab-get (format "/projects/%s%%2F%s" - (string-replace "/" "%2F" owner) - name) - nil :username username :auth auth :host host))))) - -;;; _ -(provide 'glab) -;;; glab.el ends here diff --git a/elpa/ghub-20250509.1440/gogs.el b/elpa/ghub-20250509.1440/gogs.el deleted file mode 100644 index e3378787..00000000 --- a/elpa/ghub-20250509.1440/gogs.el +++ /dev/null @@ -1,148 +0,0 @@ -;;; gogs.el --- Client library for the Gogs API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2025 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Gogs is a library that provides basic support for using the Gogs API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Gogs does -;; not support the guided creation of tokens because Gogs lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst gogs-default-host "localhost:3000/api/v1" - "The default Gogs host.") - -;; HEAD does not appear to be supported. - -(cl-defun gogs-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - 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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(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 (ghub-get (format "/repos/%s/%s" owner name) - nil :forge 'gogs - :username username :auth auth :host host))))) - -;;; _ -(provide 'gogs) -;;; gogs.el ends here diff --git a/elpa/ghub-20250509.1440/gtea.el b/elpa/ghub-20250509.1440/gtea.el deleted file mode 100644 index 4728c04f..00000000 --- a/elpa/ghub-20250509.1440/gtea.el +++ /dev/null @@ -1,148 +0,0 @@ -;;; gtea.el --- Client library for the Gitea API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2025 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Gtea is a library that provides basic support for using the Gitea API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Gtea does -;; not support the guided creation of tokens because Gitea lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst gtea-default-host "localhost:3000/api/v1" - "The default Gitea host.") - -;; HEAD does not appear to be supported. - -(cl-defun gtea-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - 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 - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(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 (ghub-get (format "/repos/%s/%s" owner name) - nil :forge 'gitea - :username username :auth auth :host host))))) - -;;; _ -(provide 'gtea) -;;; gtea.el ends here diff --git a/elpa/ghub-20250509.1440/.dir-locals.el b/elpa/ghub-20251130.1842/.dir-locals.el similarity index 100% rename from elpa/ghub-20250509.1440/.dir-locals.el rename to elpa/ghub-20251130.1842/.dir-locals.el diff --git a/elpa/ghub-20250509.1440/dir b/elpa/ghub-20251130.1842/dir similarity index 100% rename from elpa/ghub-20250509.1440/dir rename to elpa/ghub-20251130.1842/dir diff --git a/elpa/ghub-20250509.1440/ghub-autoloads.el b/elpa/ghub-20251130.1842/ghub-autoloads.el similarity index 71% rename from elpa/ghub-20250509.1440/ghub-autoloads.el rename to elpa/ghub-20251130.1842/ghub-autoloads.el index 68d71a6a..3e17afff 100644 --- a/elpa/ghub-20250509.1440/ghub-autoloads.el +++ b/elpa/ghub-20251130.1842/ghub-autoloads.el @@ -8,11 +8,6 @@ (add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) - -;;; Generated autoloads from buck.el - -(register-definition-prefixes "buck" '("buck-default-host")) - ;;; Generated autoloads from ghub.el @@ -25,7 +20,7 @@ asking the user for the correct information again. Set `url-http-real-basic-auth-storage' to nil and call `auth-source-forget+'." t) -(register-definition-prefixes "ghub" '("ghub-")) +(register-definition-prefixes "ghub" '("auth-source-netrc-parse" "ghub-")) ;;; Generated autoloads from ghub-graphql.el @@ -33,24 +28,14 @@ and call `auth-source-forget+'." t) (register-definition-prefixes "ghub-graphql" '("ghub-")) -;;; Generated autoloads from glab.el +;;; Generated autoloads from ghub-legacy.el -(register-definition-prefixes "glab" '("glab-default-host")) - - -;;; Generated autoloads from gogs.el - -(register-definition-prefixes "gogs" '("gogs-default-host")) +(register-definition-prefixes "ghub-legacy" '("ghub-fetch-repository")) ;;; Generated autoloads from gsexp.el (register-definition-prefixes "gsexp" '("gsexp-")) - - -;;; Generated autoloads from gtea.el - -(register-definition-prefixes "gtea" '("gtea-default-host")) ;;; End of scraped data diff --git a/elpa/ghub-20251130.1842/ghub-graphql.el b/elpa/ghub-20251130.1842/ghub-graphql.el new file mode 100644 index 00000000..adaaa24e --- /dev/null +++ b/elpa/ghub-20251130.1842/ghub-graphql.el @@ -0,0 +1,352 @@ +;;; ghub-graphql.el --- Access Github API using GraphQL -*- lexical-binding:t -*- + +;; Copyright (C) 2016-2025 Jonas Bernoulli + +;; Author: Jonas Bernoulli +;; Homepage: https://github.com/magit/ghub +;; Keywords: tools + +;; SPDX-License-Identifier: GPL-3.0-or-later + +;; This file is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published +;; by the Free Software Foundation, either version 3 of the License, +;; or (at your option) any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; 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) + +(eval-when-compile (require 'subr-x)) + +(define-error 'ghub-graphql-error "GraphQL Error" 'ghub-error) + +(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.") + +(cl-defun ghub-graphql-rate-limit (&key username auth host) + "Return rate limit information." + (let-alist (ghub-query + '(query (rateLimit limit cost remaining resetAt)) nil + :synchronous t :username username :auth auth :host host) + .data.rateLimit)) + +(cl-defstruct (ghub--graphql-req + (:include ghub--req) + (:constructor ghub--make-graphql-req) + (:copier nil)) + (query nil :read-only t) + (query-str nil :read-only nil) + (variables nil :read-only t) + (until nil :read-only t) + (pages 0 :read-only nil) + (paginate nil :read-only nil) + (narrow nil :read-only t)) + +(cl-defun ghub-query + (query &optional variables + &key until narrow headers paginate + callback errorback noerror synchronous + username auth host forge) + (declare (indent defun)) + (unless forge + (setq forge 'github)) + (unless host + (setq host (ghub--host forge))) + (unless (or username (stringp auth) (eq auth 'none)) + (setq username (ghub--username host forge))) + (when (eq callback 'pp) + (setq callback #'ghub--graphql-pp-response) + (setq noerror t)) + (ghub--graphql-retrieve + (ghub--make-graphql-req + :url (ghub--encode-url + host (if (eq forge 'gitlab) "/api/graphql" "/graphql")) + :method "POST" + :headers (ghub--headers headers host auth username forge) + :handler #'ghub--graphql-handle-response + :query query + :variables variables + :until until + :buffer (current-buffer) + :narrow narrow + :paginate (or paginate + (and-let* ((p (and (eq auth 'forge) + (fboundp 'magit-get) + (magit-get "forge.graphqlItemLimit")))) + (string-to-number p))) + :noerror noerror + :synchronous synchronous + :callback callback + :errorback errorback))) + +(cl-defun ghub--graphql-retrieve (req &optional lineage cursor) + (let ((p (cl-incf (ghub--graphql-req-pages req)))) + (when (> p 1) + (when ghub-graphql-message-progress + (let ((message-log-max nil)) + (message "Fetching page %s..." p))) + (ghub--graphql-set-mode-line req "Fetching page %s" p))) + (setf (ghub--graphql-req-query-str req) + (gsexp-encode + (ghub--graphql-prepare-query + (ghub--graphql-req-query req) + lineage cursor))) + (when ghub-debug + (with-current-buffer (get-buffer-create " *gsexp-encode*") + (erase-buffer) + (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 + (ghub--encode-payload + `((query . ,(ghub--graphql-req-query-str req)) + ,@(and-let* ((variables (ghub--graphql-req-variables req))) + `((variables . ,variables))))) + req) + (ghub--req-value req)) + +(defun ghub--graphql-prepare-query (query &optional lineage cursor paginate) + (when lineage + (setq query (ghub--graphql-narrow-query query lineage cursor))) + (let ((loc (ghub--alist-zip query)) + variables) + (catch :done + (while t + (let ((node (treepy-node loc))) + (when (and (vectorp node) + (listp (aref node 0))) + (let ((alist (append node ())) + (vars nil)) + (when-let ((edges (cadr (assq :edges alist)))) + (push (list 'first + (apply + #'min + (delq nil (list (and (numberp edges) edges) + paginate + ghub-graphql-items-per-request)))) + vars) + (setq loc (treepy-up loc)) + (setq node (treepy-node loc)) + (setq loc (treepy-replace + loc `(,(car node) + ,(cadr node) + (pageInfo endCursor hasNextPage) + (edges (node ,@(cddr node)))))) + (setq loc (treepy-down loc)) + (setq loc (treepy-next loc))) + (dolist (elt alist) + (cond ((keywordp (car elt))) + ((length= elt 3) + (push (list (nth 0 elt) (nth 1 elt)) vars) + (push (list (nth 1 elt) (nth 2 elt)) variables)) + ((length= elt 2) + (push elt vars)))) + (setq loc (treepy-replace loc (vconcat (nreverse vars))))))) + (if (treepy-end-p loc) + (let ((node (copy-sequence (treepy-node loc)))) + (when variables + (push (vconcat (nreverse variables)) + (cdr node))) + (throw :done node)) + (setq loc (treepy-next loc))))))) + +(defun ghub--graphql-handle-response (status req) + (let ((buf (current-buffer))) + (unwind-protect + (progn + (set-buffer-multibyte t) + (let* ((headers (ghub--handle-response-headers status req)) + (payload (ghub--handle-response-payload req)) + (err (plist-get status :error)) + (errors (and (not (and (ghub--req-noerror req) + (assq 'data payload))) + (assq 'errors payload)))) + (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) + (ghub--graphql-set-mode-line req) + (setf (ghub--req-value req) errors) + (cond-let + ([errorback (ghub--req-errorback req)] + (ghub--graphql-run-callback req errorback errors headers status req)) + ((ghub--req-noerror req) + (when-let ((callback (ghub--req-callback req))) + (ghub--graphql-run-callback req callback errors))) + ((ghub--signal-error (if (eq (car errors) 'errors) + (cons 'ghub-graphql-error (cdr errors)) + errors))))) + +(defun ghub--graphql-handle-success (req data) + (ghub--graphql-set-mode-line req) + (when-let ((narrow (ghub--graphql-req-narrow req))) + (while-let ((key (pop narrow))) + (setq data (cdr (assq key data))))) + (setf (ghub--req-value req) data) + (when-let ((callback (ghub--req-callback req))) + (ghub--graphql-run-callback req callback data))) + +(defun ghub--graphql-run-callback (req callback &rest args) + (let ((buffer (ghub--req-buffer req))) + (if (buffer-live-p buffer) + (with-current-buffer buffer + (apply callback args)) + (apply callback args)))) + +(defun ghub--graphql-set-mode-line (req &optional format &rest args) + (let ((buffer (ghub--graphql-req-buffer req))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (setq mode-line-process + (and format (concat " " (apply #'format format args)))) + (force-mode-line-update t))))) + +(defun ghub--graphql-pp-response (data) + (pp-display-expression data "*Pp Eval Output*")) + +(defun ghub--graphql-walk-response (req data) + (let* ((loc (ghub--req-value req)) + (loc (if (not loc) + (ghub--alist-zip data) + (setq data (ghub--graphql-narrow-data + data (ghub--graphql-lineage loc))) + (setf (alist-get 'edges data) + (append (alist-get 'edges (treepy-node loc)) + (or (alist-get 'edges data) + (error "BUG: Expected new nodes")))) + (treepy-replace loc data)))) + (catch :done + (while t + (when (eq (car-safe (treepy-node loc)) 'edges) + (setq loc (treepy-up loc)) + (pcase-let ((`(,key . ,val) (treepy-node loc))) + (let-alist val + (let* ((cursor (and .pageInfo.hasNextPage + .pageInfo.endCursor)) + (until (cdr (assq (intern (format "%s-until" key)) + (ghub--graphql-req-until req)))) + (nodes (mapcar #'cdar .edges)) + (nodes (if until + (seq-take-while + (lambda (node) + (or (string> (cdr (assq 'updatedAt node)) + until) + (setq cursor nil))) + nodes) + nodes))) + (cond (cursor + (setf (ghub--req-value req) loc) + (ghub--graphql-retrieve req + (ghub--graphql-lineage loc) + cursor) + (throw :done nil)) + ((setq loc (treepy-replace loc (cons key nodes))))))))) + (if (treepy-end-p loc) + (progn (ghub--graphql-handle-success req (treepy-root loc)) + (throw :done nil)) + (setq loc (treepy-next loc))))))) + +(defun ghub--graphql-lineage (loc) + (let (lineage) + (while (treepy-up loc) + (push (car (treepy-node loc)) lineage) + (setq loc (treepy-up loc))) + lineage)) + +(defun ghub--graphql-narrow-data (data lineage) + (while-let ((key (pop lineage))) + (if (consp (car lineage)) + (progn (pop lineage) + (setf data (cadr data))) + (setq data (assq key (cdr data))))) + data) + +(defun ghub--graphql-narrow-query (query lineage &optional cursor) + (if (consp (car lineage)) + (let* ((child (cddr query)) + (alist (append (cadr query) ())) + (single (cdr (assq :singular alist)))) + `(,(car single) + ,(vector (list (cadr single) (cdr (car lineage)))) + ,@(if (cdr lineage) + (ghub--graphql-narrow-query child (cdr lineage) cursor) + child))) + (let* ((child (or (assq (car lineage) (cdr query)) + ;; Alias + (cl-find-if (lambda (c) + (eq (car-safe (car-safe c)) + (car lineage))) + query) + ;; Edges + (cl-find-if (lambda (c) + (and (listp c) + (vectorp (cadr c)) + (eq (cadr (assq :singular + (append (cadr c) ()))) + (car lineage)))) + (cdr query)) + (error "BUG: Failed to narrow query"))) + (object (car query)) + (args (and (vectorp (cadr query)) + (cadr query)))) + `(,object + ,@(and args (list args)) + ,(cond ((cdr lineage) + (ghub--graphql-narrow-query child (cdr lineage) cursor)) + (cursor + `(,(car child) + ,(vconcat `((after ,cursor)) + (cadr child)) + ,@(cddr child))) + (t + child)))))) + +(defun ghub--alist-zip (root) + (let ((branchp (##and (listp %) (listp (cdr %)))) + (make-node (lambda (_ children) children))) + (treepy-zipper branchp #'identity make-node root))) + +;;; _ +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("and-let" . "cond-let--and-let") +;; ("if-let" . "cond-let--if-let") +;; ("when-let" . "cond-let--when-let") +;; ("while-let" . "cond-let--while-let")) +;; End: +(provide 'ghub-graphql) +;;; ghub-graphql.el ends here diff --git a/elpa/ghub-20251130.1842/ghub-legacy.el b/elpa/ghub-20251130.1842/ghub-legacy.el new file mode 100644 index 00000000..4c46b3c0 --- /dev/null +++ b/elpa/ghub-20251130.1842/ghub-legacy.el @@ -0,0 +1,377 @@ +;;; ghub-legacy.el --- Deprecated Ghub functions -*- lexical-binding:t -*- + +;; Copyright (C) 2016-2025 Jonas Bernoulli + +;; Author: Jonas Bernoulli +;; Homepage: https://github.com/magit/ghub +;; Keywords: tools + +;; SPDX-License-Identifier: GPL-3.0-or-later + +;; This file is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published +;; by the Free Software Foundation, either version 3 of the License, +;; or (at your option) any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this file. If not, see . + +;;; Commentary: + +;; Deprecated Ghub functions. + +;;; Code: + +(require 'ghub-graphql) + +(cl-defun ghub-graphql (graphql + &optional variables + &key username auth host forge + headers silent + callback errorback value extra) + (cl-assert (not (stringp variables))) + (cl-assert (or (stringp graphql) + (memq (car-safe graphql) '(query mutation)))) + (unless (stringp graphql) + (setq graphql (gsexp-encode (ghub--graphql-prepare-query graphql)))) + (ghub-request "POST" + (if (eq forge 'gitlab) "/api/graphql" "/graphql") + nil + :payload `((query . ,graphql) + ,@(and variables `((variables ,@variables)))) + :headers headers :silent silent + :username username :auth auth :host host :forge forge + :callback callback :errorback errorback + :extra extra :value value)) + +(cl-defun ghub--graphql (graphql + &optional variables + &key username auth host forge + headers + callback errorback) + (ghub--graphql-vacuum graphql variables callback nil + :username username + :auth auth + :host host + :forge forge + :headers headers + :errorback errorback)) + +(cl-defun ghub--graphql-vacuum + ( query variables callback + &optional until + &key narrow username auth host forge + headers paginate errorback noerror synchronous) + (ghub-query query variables + :until until :narrow narrow :headers headers :paginate paginate + :callback callback + :errorback errorback :noerror noerror :synchronous synchronous + :username username :auth auth :host host :forge forge)) + +(defconst ghub-fetch-repository-sparse + '(query + (repository + [(owner $owner String!) + (name $name String!)] + name + id + createdAt + updatedAt + nameWithOwner + (parent nameWithOwner) + description + homepageUrl + (defaultBranchRef name) + isArchived + isFork + isLocked + isMirror + isPrivate + hasDiscussionsEnabled + hasIssuesEnabled + hasWikiEnabled + (licenseInfo name) + (stargazers totalCount) + (watchers totalCount)))) + +(defconst ghub-fetch-repository + `(query + (repository + ,@(cdr (cadr ghub-fetch-repository-sparse)) + (assignableUsers [(:edges t)] + 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)))] + number + id + state + stateReason + isReadByViewer + (author login) + title + createdAt + updatedAt + closedAt + locked + (milestone id) + body + (assignees [(:edges t)] + id) + (comments [(:edges t)] + id + databaseId + (author login) + createdAt + updatedAt + body) + (labels [(:edges t)] + id)) + (labels [(:edges t) + (:singular label id)] + id + name + color + description) + (milestones [(:edges t) + (:singular milestone id)] + id + number + title + createdAt + updatedAt + dueOn + closedAt + description) + (pullRequests [(:edges t) + (:singular pullRequest number) + (orderBy ((field UPDATED_AT) (direction DESC)))] + number + id + state + isReadByViewer + (author login) + title + createdAt + updatedAt + closedAt + mergedAt + isDraft + locked + maintainerCanModify + isCrossRepository + (milestone id) + body + (baseRef name + (repository nameWithOwner)) + baseRefOid + (headRef name + (repository (owner login) + nameWithOwner)) + headRefOid + (assignees [(:edges t)] + id) + (reviewRequests [(:edges t)] + (requestedReviewer "... on User { id }\n")) + (comments [(:edges t)] + id + databaseId + (author login) + createdAt + updatedAt + body) + (labels [(:edges t)] + id))))) + +(defconst ghub-fetch-repository-review-threads + '(query + (repository + [(owner $owner String!) + (name $name String!)] + (pullRequests [(:edges t) + (:singular pullRequest number) + (orderBy ((field UPDATED_AT) (direction DESC)))] + number + baseRefOid + headRefOid + (reviewThreads [(:edges t)] + id + line + originalLine + diffSide + (resolvedBy login) + (comments [(:edges t)] + id + databaseId + (author login) + createdAt + updatedAt + body + (replyTo databaseId) + (originalCommit oid) + path)))))) + +(cl-defun ghub-fetch-repository ( owner name callback + &optional until + &key username auth host forge + headers paginate errorback sparse) + "Asynchronously fetch forge data about the specified repository. +Once all data has been collected, CALLBACK is called with the +data as the only argument." + (ghub-query (if sparse + ghub-fetch-repository-sparse + ghub-fetch-repository) + `((owner . ,owner) + (name . ,name)) + :until until + :narrow '(repository) + :username username + :auth auth + :host host + :forge forge + :headers headers + :paginate paginate + :callback callback + :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-query (ghub--graphql-prepare-query + ghub-fetch-repository + `(repository discussions (discussion . ,number))) + `((owner . ,owner) + (name . ,name)) + :until until + :narrow '(repository discussion) + :username username + :auth auth + :host host + :forge forge + :headers headers + :callback callback + :errorback errorback)) + +(cl-defun ghub-fetch-issue ( owner name number callback + &optional until + &key username auth host forge + headers paginate errorback) + "Asynchronously fetch forge data about the specified issue. +Once all data has been collected, CALLBACK is called with the +data as the only argument." + (ghub-query (ghub--graphql-narrow-query + ghub-fetch-repository + `(repository issues (issue . ,number))) + `((owner . ,owner) + (name . ,name)) + :until until + :narrow '(repository issue) + :username username + :auth auth + :host host + :forge forge + :headers headers + :paginate paginate + :callback callback + :errorback errorback)) + +(cl-defun ghub-fetch-pullreq ( owner name number callback + &optional until + &key username auth host forge + headers paginate errorback) + "Asynchronously fetch forge data about the specified pull-request. +Once all data has been collected, CALLBACK is called with the +data as the only argument." + (ghub-query (ghub--graphql-narrow-query + ghub-fetch-repository + `(repository pullRequests (pullRequest . ,number))) + `((owner . ,owner) + (name . ,name)) + :until until + :narrow '(repository pullRequest) + :username username + :auth auth + :host host + :forge forge + :headers headers + :paginate paginate + :callback callback + :errorback errorback)) + +(cl-defun ghub-fetch-review-threads ( owner name number callback + &optional until + &key username auth host forge + headers paginate errorback) + "Asynchronously fetch forge data about the review threads from a pull-request. +Once all data has been collected, CALLBACK is called with the +data as the only argument." + (ghub-query (ghub--graphql-narrow-query + ghub-fetch-repository-review-threads + `(repository pullRequests (pullRequest . ,number))) + `((owner . ,owner) + (name . ,name)) + :until until + :narrow '(repository pullRequest) + :username username + :auth auth + :host host + :forge forge + :headers headers + :paginate paginate + :callback callback + :errorback errorback)) + +;;; _ +(provide 'ghub-legacy) +;;; ghub-legacy.el ends here diff --git a/elpa/ghub-20250509.1440/ghub-pkg.el b/elpa/ghub-20251130.1842/ghub-pkg.el similarity index 55% rename from elpa/ghub-20250509.1440/ghub-pkg.el rename to elpa/ghub-20251130.1842/ghub-pkg.el index 1c10d3a2..432944d3 100644 --- a/elpa/ghub-20250509.1440/ghub-pkg.el +++ b/elpa/ghub-20251130.1842/ghub-pkg.el @@ -1,14 +1,14 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "ghub" "20250509.1440" +(define-package "ghub" "20251130.1842" "Client libraries for Git forge APIs." - '((emacs "29.1") - (compat "30.1.0.0") - (let-alist "1.0.6") - (llama "0.6.2") - (treepy "0.1.2")) + '((emacs "29.1") + (compat "30.1") + (cond-let "0.2") + (llama "1.0") + (treepy "0.1.2")) :url "https://github.com/magit/ghub" - :commit "6bb612e7b7eada22569d84cc529f4ca36e08032d" - :revdesc "6bb612e7b7ea" + :commit "9f416605d560ed2a6b62a87d1f624549901b1102" + :revdesc "9f416605d560" :keywords '("tools") :authors '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev")) :maintainers '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev"))) diff --git a/elpa/ghub-20250509.1440/ghub.el b/elpa/ghub-20251130.1842/ghub.el similarity index 75% rename from elpa/ghub-20250509.1440/ghub.el rename to elpa/ghub-20251130.1842/ghub.el index f56484ef..317fe329 100644 --- a/elpa/ghub-20250509.1440/ghub.el +++ b/elpa/ghub-20251130.1842/ghub.el @@ -6,13 +6,13 @@ ;; Homepage: https://github.com/magit/ghub ;; Keywords: tools -;; Package-Version: 20250509.1440 -;; Package-Revision: 6bb612e7b7ea +;; Package-Version: 20251130.1842 +;; Package-Revision: 9f416605d560 ;; Package-Requires: ( -;; (emacs "29.1") -;; (compat "30.1.0.0") -;; (let-alist "1.0.6") -;; (llama "0.6.2") +;; (emacs "29.1") +;; (compat "30.1") +;; (cond-let "0.2") +;; (llama "1.0") ;; (treepy "0.1.2")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -39,10 +39,7 @@ ;; Ghub abstracts access to API resources using only a handful of basic ;; functions such as `ghub-get'. These are convenience wrappers around -;; `ghub-request'. Additional forge-specific wrappers like `glab-put', -;; `gtea-put', `gogs-post' and `buck-delete' are also available. Ghub -;; does not provide any resource-specific functions, with the exception -;; of `FORGE-repository-id'. +;; `ghub-request'. ;; When accessing Github, then Ghub handles the creation and storage of ;; access tokens using a setup wizard to make it easier for users to get @@ -62,6 +59,7 @@ (require 'auth-source) (require 'cl-lib) (require 'compat) +(require 'cond-let) (require 'gnutls) (require 'let-alist) (require 'llama) @@ -71,11 +69,6 @@ (eval-when-compile (require 'subr-x)) -(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)) -(declare-function buck-repository-id "buck" (owner name &key username auth host)) - (defvar url-callback-arguments) (defvar url-http-end-of-headers) (defvar url-http-extra-headers) @@ -83,8 +76,13 @@ ;;; Settings -(defconst ghub-default-host "api.github.com" - "The default host that is used if `ghub.host' is not set.") +(defvar ghub-default-host-alist + '((github . "api.github.com") + (gitlab . "gitlab.com/api/v4") + (gitea . "localhost:3000/api/v1") + (gogs . "localhost:3000/api/v1") + (bitbucket . "api.bitbucket.org/2.0")) + "Alist of default hosts used when the respective `FORGE.host' is not set.") (defvar ghub-github-token-scopes '(repo) "The Github API scopes that your private tools need. @@ -105,20 +103,21 @@ only serves as documentation.") (cl-defstruct (ghub--req (:constructor ghub--make-req) (:copier nil)) - (url nil :read-only nil) - (forge nil :read-only t) - (silent nil :read-only t) - (method nil :read-only t) - (headers nil :read-only t) - (handler nil :read-only t) - (unpaginate nil :read-only nil) - (noerror nil :read-only t) - (reader nil :read-only t) - (buffer nil :read-only t) - (callback nil :read-only t) - (errorback nil :read-only t) - (value nil :read-only nil) - (extra nil :read-only nil)) + (url nil :read-only nil) + (forge nil :read-only t) + (silent nil :read-only t) + (method nil :read-only t) + (headers nil :read-only t) + (handler nil :read-only t) + (unpaginate nil :read-only nil) + (noerror nil :read-only t) + (reader nil :read-only t) + (buffer nil :read-only t) + (synchronous nil :read-only t) + (callback nil :read-only t) + (errorback nil :read-only t) + (value nil :read-only nil) + (extra nil :read-only nil)) (defalias 'ghub-req-extra #'ghub--req-extra) @@ -151,7 +150,7 @@ Like calling `ghub-request' (which see) with \"HEAD\" as METHOD." &optional params &key query payload headers silent unpaginate noerror reader - username auth host + username auth host forge callback errorback extra) "Make a `GET' request for RESOURCE, with optional query PARAMS. Like calling `ghub-request' (which see) with \"GET\" as METHOD." @@ -159,14 +158,14 @@ Like calling `ghub-request' (which see) with \"GET\" as METHOD." :query query :payload payload :headers headers :silent silent :unpaginate unpaginate :noerror noerror :reader reader - :username username :auth auth :host host + :username username :auth auth :host host :forge forge :callback callback :errorback errorback :extra extra)) (cl-defun ghub-put (resource &optional params &key query payload headers silent unpaginate noerror reader - username auth host + username auth host forge callback errorback extra) "Make a `PUT' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PUT\" as METHOD." @@ -174,14 +173,14 @@ Like calling `ghub-request' (which see) with \"PUT\" as METHOD." :query query :payload payload :headers headers :silent silent :unpaginate unpaginate :noerror noerror :reader reader - :username username :auth auth :host host + :username username :auth auth :host host :forge forge :callback callback :errorback errorback :extra extra)) (cl-defun ghub-post (resource &optional params &key query payload headers silent unpaginate noerror reader - username auth host + username auth host forge callback errorback extra) "Make a `POST' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"POST\" as METHOD." @@ -189,14 +188,14 @@ Like calling `ghub-request' (which see) with \"POST\" as METHOD." :query query :payload payload :headers headers :silent silent :unpaginate unpaginate :noerror noerror :reader reader - :username username :auth auth :host host + :username username :auth auth :host host :forge forge :callback callback :errorback errorback :extra extra)) (cl-defun ghub-patch (resource &optional params &key query payload headers silent unpaginate noerror reader - username auth host + username auth host forge callback errorback extra) "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"PATCH\" as METHOD." @@ -204,14 +203,14 @@ Like calling `ghub-request' (which see) with \"PATCH\" as METHOD." :query query :payload payload :headers headers :silent silent :unpaginate unpaginate :noerror noerror :reader reader - :username username :auth auth :host host + :username username :auth auth :host host :forge forge :callback callback :errorback errorback :extra extra)) (cl-defun ghub-delete (resource &optional params &key query payload headers silent unpaginate noerror reader - username auth host + username auth host forge callback errorback extra) "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. Like calling `ghub-request' (which see) with \"DELETE\" as METHOD." @@ -219,7 +218,7 @@ Like calling `ghub-request' (which see) with \"DELETE\" as METHOD." :query query :payload payload :headers headers :silent silent :unpaginate unpaginate :noerror noerror :reader reader - :username username :auth auth :host host + :username username :auth auth :host host :forge forge :callback callback :errorback errorback :extra extra)) (cl-defun ghub-request ( method resource @@ -295,10 +294,9 @@ If HOST is non-nil, then connect to that Github instance. This that using the Git variable `github.host' instead of using this argument. -If FORGE is `gitlab', then connect to Gitlab.com or, depending - on HOST, to another Gitlab instance. This is only intended for - internal use. Instead of using this argument you should use - function `glab-request' and other `glab-*' functions. +If optional FORGE is nil, then it is assumed that HOST is a + Github host. When connecting to another forge type, then + FORGE must be one of `gitlab', `gitea', `gogs' or `bitbucket'. If CALLBACK and/or ERRORBACK is non-nil, then make one or more asynchronous requests and call CALLBACK or ERRORBACK when @@ -320,6 +318,7 @@ Both callbacks are called with four arguments. argument. 4. A `ghub--req' struct, which can be passed to `ghub-continue' (which see) to retrieve the next page, if any." + (declare (indent defun)) (cl-assert (or (booleanp unpaginate) (natnump unpaginate))) (unless (string-prefix-p "/" resource) (setq resource (concat "/" resource))) @@ -343,33 +342,21 @@ Both callbacks are called with four arguments. (ghub--retrieve (ghub--encode-payload payload) (ghub--make-req - :url (url-generic-parse-url - (concat (if (member host ghub-insecure-hosts) "http://" "https://") - (cond ((and (equal resource "/graphql") - (string-suffix-p "/v3" host)) - ;; Needed for some Github Enterprise instances. - (substring host 0 -3)) - ((and (equal resource "/api/graphql") - (string-suffix-p "/api/v4" host)) - ;; Needed for all Gitlab instances. - (substring host 0 -7)) - (host)) - resource - (and query (concat "?" (ghub--url-encode-params query))))) - :forge forge - :silent silent - ;; Encode in case caller used (symbol-name 'GET). #35 - :method (encode-coding-string method 'utf-8) - :headers (ghub--headers headers host auth username forge) - :handler #'ghub--handle-response - :unpaginate unpaginate - :noerror noerror - :reader reader - :buffer (current-buffer) - :callback callback - :errorback errorback - :value value - :extra extra))) + :url (ghub--encode-url host resource query) + :forge forge + :silent silent + :method (encode-coding-string method 'utf-8) ;#35 + :headers (ghub--headers headers host auth username forge) + :handler #'ghub--handle-response + :unpaginate unpaginate + :noerror noerror + :reader reader + :buffer (current-buffer) + :synchronous (not (or callback errorback)) + :callback callback + :errorback errorback + :value value + :extra extra))) (defun ghub-continue (req) "If there is a next page, then retrieve that. @@ -454,43 +441,61 @@ this function is called with nil for PAYLOAD." (cl-defun ghub-repository-id (owner name &key username auth host forge noerror) "Return the id of the specified repository. Signal an error if the id cannot be determined." - (let ((fn (cl-case forge - ((nil ghub github) #'ghub--repository-id) - (gitlab #'glab-repository-id) - (gitea #'gtea-repository-id) - (gogs #'gogs-repository-id) - (bitbucket #'buck-repository-id) - (t (intern (format "%s-repository-id" forge)))))) - (unless (fboundp fn) - (error "ghub-repository-id: Forge type/abbreviation `%s' is unknown" - forge)) - (or (funcall fn owner name :username username :auth auth :host host) - (and (not noerror) - (error "Repository %S does not exist on %S.\n%s%S?" - (concat owner "/" name) - (or host (ghub--host forge)) - "Maybe it was renamed and you have to update " - "remote..url"))))) + (or (pcase forge + ((or 'nil 'github) + (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)) + ('gitlab + (number-to-string + (alist-get + 'id (ghub-get (format "/projects/%s%%2F%s" + (string-replace "/" "%2F" owner) + name) + nil :forge 'gitlab + :username username :auth auth :host host)))) + ((or 'forgejo 'gitea 'gogs) + (number-to-string + (alist-get + 'id (ghub-get (format "/repos/%s/%s" owner name) + nil :forge forge + :username username :auth auth :host host)))) + ('bitbucket + (substring + (alist-get 'uuid + (ghub-get (format "/repositories/%s/%s" owner name) + nil :forge 'bitbucket + :username username :auth auth :host host)) + 1 -1)) + (_ (error "ghub-repository-id: Forge type `%s' is unknown" forge))) + (and (not noerror) + (error "Repository %S does not exist on %S.\n%s%S?" + (concat owner "/" name) + (or host (ghub--host forge)) + "Maybe it was renamed and you have to update " + "remote..url")))) ;;;; Internal (cl-defun ghub--retrieve (payload req) - (let ((url-request-extra-headers - (let ((headers (ghub--req-headers req))) - (if (functionp headers) (funcall headers) headers))) - (url-request-method (ghub--req-method req)) - (url-request-data payload) - (url-show-status nil) - (url (ghub--req-url req)) - (handler (ghub--req-handler req)) - (silent (ghub--req-silent req))) - (if (or (ghub--req-callback req) - (ghub--req-errorback req)) - (url-retrieve url handler (list req) silent) - (if-let ((buf (url-retrieve-synchronously url silent))) - (with-current-buffer buf - (funcall handler (car url-callback-arguments) req)) - (error "ghub--retrieve: No buffer returned"))))) + (pcase-let* + (((cl-struct ghub--req headers method url handler silent synchronous) req) + (url-request-extra-headers + (if (functionp headers) (funcall headers) headers)) + (url-request-method method) + (url-request-data payload) + (url-show-status nil)) + (if synchronous + (if-let ((buf (url-retrieve-synchronously url silent))) + (with-current-buffer buf + (funcall handler (car url-callback-arguments) req)) + (error "ghub--retrieve: No buffer returned")) + (url-retrieve url handler (list req) silent)))) (defun ghub--handle-response (status req) (let ((buf (current-buffer))) @@ -596,25 +601,27 @@ Signal an error if the id cannot be determined." (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")))))) + (progn + (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 + (when ghub-debug + (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)) @@ -633,6 +640,22 @@ Signal an error if the id cannot be determined." :false-object nil) 'utf-8)))) +(defun ghub--encode-url (host resource &optional query) + (url-generic-parse-url + (concat (if (member host ghub-insecure-hosts) "http://" "https://") + ;; Needed for some Github Enterprise instances. + (cond + ((and (equal resource "/graphql") + (string-suffix-p "/v3" host)) + (substring host 0 -3)) + ;; Needed for all Gitlab instances. + ((and (equal resource "/api/graphql") + (string-suffix-p "/api/v4" host)) + (substring host 0 -7)) + (host)) + resource + (and query (concat "?" (ghub--url-encode-params query)))))) + (defun ghub--url-encode-params (params) (mapconcat (lambda (param) (pcase-let ((`(,key . ,val) param)) @@ -683,17 +706,15 @@ and call `auth-source-forget+'." (unless username (setq username (ghub--username host forge))) (if (eq auth 'basic) - (cl-ecase forge - ((nil gitea gogs bitbucket) + (pcase-exhaustive forge + ((or 'nil 'forgejo 'gitea 'gogs 'bitbucket) (cons "Authorization" (ghub--basic-auth host username))) - ((github gitlab) + ((or 'github 'gitlab) (error "%s does not support basic authentication" (capitalize (symbol-name forge))))) - (cons (cl-ecase forge - ((nil github gitea gogs bitbucket) - "Authorization") - (gitlab - "Private-Token")) + (cons (pcase-exhaustive forge + ((or 'nil 'forgejo 'github 'gitea 'gogs 'bitbucket) "Authorization") + ('gitlab "Private-Token")) (if (eq forge 'bitbucket) ;; For some undocumented reason Bitbucket supports ;; values of the form "token " only for GET @@ -734,7 +755,7 @@ and call `auth-source-forget+'." (unless (or token nocreate) (error "\ Required %s token (%S for %s%S) does not exist. -See https://magit.vc/manual/ghub/Getting-Started.html +See https://docs.magit.vc/ghub/Getting-Started.html or (info \"(ghub)Getting Started\") for instructions." (capitalize (symbol-name (or forge 'github))) user @@ -744,73 +765,29 @@ or (info \"(ghub)Getting Started\") for instructions." host)) (if (functionp token) (funcall token) token))) -(cl-defgeneric ghub--host (&optional forge) - (cl-ecase forge - ((nil github) - (or (ignore-errors (car (process-lines "git" "config" "github.host"))) - ghub-default-host)) - (gitlab - (or (ignore-errors (car (process-lines "git" "config" "gitlab.host"))) - (bound-and-true-p glab-default-host))) - (gitea - (or (ignore-errors (car (process-lines "git" "config" "gitea.host"))) - (bound-and-true-p gtea-default-host))) - (gogs - (or (ignore-errors (car (process-lines "git" "config" "gogs.host"))) - (bound-and-true-p gogs-default-host))) - (bitbucket - (or (ignore-errors (car (process-lines "git" "config" "bitbucket.host"))) - (bound-and-true-p buck-default-host))))) - -(cl-defgeneric ghub--username (host &optional forge) - (let ((var - (cl-ecase forge - ((nil github) - (if (equal host ghub-default-host) - "github.user" - (format "github.%s.user" host))) - (gitlab - (if (equal host "gitlab.com/api/v4") - "gitlab.user" - (format "gitlab.%s.user" host))) - (bitbucket - (if (equal host "api.bitbucket.org/2.0") - "bitbucket.user" - (format "bitbucket.%s.user" host))) - (gitea - (when (zerop (call-process "git" nil nil nil "config" "gitea.host")) - (message "WARNING: gitea.host is set but always ignored")) - (format "gitea.%s.user" host)) - (gogs - (when (zerop (call-process "git" nil nil nil "config" "gogs.host")) - (message "WARNING: gogs.host is set but always ignored")) - (format "gogs.%s.user" host))))) - (condition-case nil - (car (process-lines "git" "config" var)) - (error - (let ((user (read-string - (format "Git variable `%s' is unset. Set to: " var)))) - (if (equal user "") - (user-error "The empty string is not a valid username") - (call-process - "git" nil nil nil "config" - (if (eq (read-char-choice - (format "Set %s=%s [g]lobally (recommended) or [l]ocally? " - var user) - (list ?g ?l)) - ?g) - "--global" - "--local") - var user) - user)))))) +(cl-defmethod ghub--host (&optional forge) + (let ((forge (or forge 'github))) + (or (ghub--git-get (format "%s.host" forge)) + (alist-get forge ghub-default-host-alist)))) + +(cl-defmethod ghub--username (host &optional forge) + (let* ((forge (or forge 'github)) + (host (or host (ghub--host forge))) + (var (format "%s.%s.user" forge host)) + (default-var (format "%s.user" forge))) + (cond ((ghub--git-get var)) + ((not (equal host (alist-get forge ghub-default-host-alist))) + (user-error "Cannot determine username; `%s' is unset" var)) + ((ghub--git-get default-var)) + ((user-error "%s; `%s' and `%s' are both unset" + "Cannot determine username" var default-var))))) (defun ghub--ident (username package) (format "%s^%s" username package)) (defun ghub--auth-source-get (keys &rest spec) (declare (indent 1)) - (if-let ((plist (car (apply #'auth-source-search - (append spec (list :max 1)))))) + (if-let ((plist (car (apply #'auth-source-search spec)))) (if (keywordp keys) (plist-get plist keys) (mapcar (##plist-get plist %) keys)) @@ -820,7 +797,30 @@ or (info \"(ghub)Getting Started\") for instructions." (auth-source-forget spec) nil)) +(define-advice auth-source-netrc-parse (:around (fn &rest args) handle-symlink) + "Follow symlinks for FILE before comparing modification times." + (let ((file (plist-get args :file))) + (when (and (stringp file) + (file-exists-p file)) + (setq args (plist-put args :file (file-chase-links file))))) + (apply fn args)) + +(defun ghub--git-get (var) + (catch 'non-zero + (car (process-lines-handling-status + "git" (##unless (zerop %) (throw 'non-zero nil)) + ;; Beginning with Git v2.46 we could use "get". + "config" "--get" var)))) + ;;; _ +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("and-let" . "cond-let--and-let") +;; ("if-let" . "cond-let--if-let") +;; ("when-let" . "cond-let--when-let") +;; ("while-let" . "cond-let--while-let")) +;; End: (provide 'ghub) (require 'ghub-graphql) +(require 'ghub-legacy) ;;; ghub.el ends here diff --git a/elpa/ghub-20250509.1440/ghub.info b/elpa/ghub-20251130.1842/ghub.info similarity index 77% rename from elpa/ghub-20250509.1440/ghub.info rename to elpa/ghub-20251130.1842/ghub.info index 93914b6e..8cfce139 100644 --- a/elpa/ghub-20250509.1440/ghub.info +++ b/elpa/ghub-20251130.1842/ghub.info @@ -27,7 +27,7 @@ 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.3.1. +This manual is for Ghub version 5.0.2. Copyright (C) 2017-2025 Jonas Bernoulli @@ -66,7 +66,6 @@ API * Making REST Requests:: * Making GraphQL Requests:: * Github Convenience Wrappers:: -* Non-Github Convenience Wrappers:: Notes @@ -180,12 +179,12 @@ For ‘gitlab’ and ‘bitbucket’ forges similar variables are available: • ‘gitlab.HOST.user’ specifies the user for the HOST ‘gitlab’ instance. • ‘gitlab.host’ specifies the ‘gitlab’ host, unless the HOST argument - is non-nil + is non-‘nil’ • ‘bitbucket.user’ specifies the user. • ‘bitbucket.HOST.user’ specifies the user for the HOST ‘bitbucket’ instance. • ‘bitbucket.host’ specifies the ‘bitbucket’ host, unless the HOST - argument is non-nil. + argument is non-‘nil’. For the ‘gitea’ and ‘gogs’ forges some similar variables are available, however for some of the ‘ghub.*’ variables no equivalent @@ -195,12 +194,12 @@ variable exist for these two forges: exists. • ‘gitea.HOST.user’ specifies the user for the HOST ‘gitea’ instance. • ‘gitea.host’ specifies the ‘gitea’ host, unless the HOST argument - is non-nil + is non-‘nil’ • ‘gogs.user’ is *not* used because no canonical ‘gogs’ instance exists. • ‘gogs.HOST.user’ specifies the user for the HOST ‘gogs’ instance. • ‘gogs.host’ specifies the ‘gogs’ host, unless the HOST argument is - non-nil + non-‘nil’  File: ghub.info, Node: Setting the Username, Next: Creating and Storing a Token, Prev: Basic Concepts Arguments and Variables, Up: Getting Started @@ -297,7 +296,7 @@ To create a token, use the web interface of the host you want to connect to. Here is a list of pages to do this for certain popular hosts: • - • + • For other forges we cannot provide a functioning URL because they contain unknown values such as your name. Just go to the general @@ -405,7 +404,6 @@ File: ghub.info, Node: API, Next: Notes, Prev: Getting Started, Up: Top * Making REST Requests:: * Making GraphQL Requests:: * Github Convenience Wrappers:: -* Non-Github Convenience Wrappers::  File: ghub.info, Node: Their APIs, Next: Making REST Requests, Up: API @@ -418,17 +416,17 @@ supports, but for your convenience, here are the links to their API manuals: • Github: - • (GraphQl) - • (REST) + • (GraphQl) + • (REST) • Gitlab: - • + • • Gitea: - • - • + • + • • Gogs: - • + • • Bitbucket: - • + •  File: ghub.info, Node: Making REST Requests, Next: Making GraphQL Requests, Prev: Their APIs, Up: API @@ -474,24 +472,24 @@ File: ghub.info, Node: Making REST Requests, Next: Making GraphQL Requests, P or payload. When that is the case, then the Github API documentation usually mentions it explicitly. - • If ‘SILENT’ is non-nil, then progress reports and the like are - not messaged. + • If ‘SILENT’ is non-‘nil’, then progress reports and the like + are not messaged. - • If ‘UNPAGINATE’ is t, then this function makes as many + • If ‘UNPAGINATE’ is ‘t’, then this function makes as many requests as necessary to get all values. If ‘UNPAGINATE’ is a natural number, then it gets at most that many pages. For any - other non-nil value it raises an error. + other non-‘nil’ value it raises an error. - • If ‘NOERROR’ is non-nil, then no error is raised if the + • If ‘NOERROR’ is non-‘nil’, then no error is raised if the request fails and ‘nil’ is returned instead. If ‘NOERROR’ is ‘return’, then the error payload is returned instead of ‘nil’. - • If ‘READER’ is non-nil, then it is used to read and return + • If ‘READER’ is non-‘nil’, then it is used to read and return from the response buffer. The default is ‘ghub--read-json-payload’. For the very few resources that do not return JSON, you might want to use ‘ghub--decode-payload’. - • If ‘USERNAME’ is non-nil, then the request is made on behalf + • If ‘USERNAME’ is non-‘nil’, then the request is made on behalf of that user. It is better to specify the user using the Git variable ‘github.user’ for "api.github.com", or ‘github.HOST.user’ if connecting to a Github Enterprise @@ -520,25 +518,22 @@ File: ghub.info, Node: Making REST Requests, Next: Making GraphQL Requests, P if that is not specified. See ‘ghub-github-token-scopes’ for an example. - • If ‘HOST’ is non-nil, then connect to that Github instance. + • If ‘HOST’ is non-‘nil’, then connect to that Github instance. This defaults to "api.github.com". When a repository is connected to a Github Enterprise instance, then it is better to specify that using the Git variable ‘github.host’ instead of using this argument. • If ‘FORGE’ is ‘gitlab’, then connect to Gitlab.com or, - depending on ‘HOST’, to another Gitlab instance. This is only - intended for internal use. Instead of using this argument you - should use function ‘glab-request’ and other ‘glab-*’ - functions. + depending on ‘HOST’, to another Gitlab instance. - • If ‘CALLBACK’ and/or ‘ERRORBACK’ is non-nil, then this + • If ‘CALLBACK’ and/or ‘ERRORBACK’ is non-‘nil’, then this function makes one or more asynchronous requests and calls ‘CALLBACK’ or ‘ERRORBACK’ when finished. If no error occurred, then it calls ‘CALLBACK’, unless that is ‘nil’. If an error occurred, then it calls ‘ERRORBACK’, or if that is - nil, then ‘CALLBACK’. ‘ERRORBACK’ can also be ‘t’, in which + ‘nil’, then ‘CALLBACK’. ‘ERRORBACK’ can also be ‘t’, in which case it signals instead. ‘NOERROR’ is ignored for all asynchronous requests. @@ -560,8 +555,9 @@ File: ghub.info, Node: Making REST Requests, Next: Making GraphQL Requests, P This function is only intended to be called from callbacks. If there is a next page, then that is retrieved and the buffer that - the result will be loaded into is returned, or t if the process has - already completed. If there is no next page, then return nil. + the result will be loaded into is returned, or ‘t’ if the process + has already completed. If there is no next page, then return + ‘nil’. Callbacks are called with four arguments (see ‘ghub-request’). The forth argument is a ‘ghub--req’ struct, intended to be passed to @@ -606,7 +602,7 @@ File: ghub.info, Node: Making REST Requests, Next: Making GraphQL Requests, P -- Function: ghub-response-link-relations req headers payload This function returns an alist of the link relations in ‘HEADERS’, - or if optional ‘HEADERS’ is nil, then those in + or if optional ‘HEADERS’ is ‘nil’, then those in ‘ghub-response-headers’. When accessing a Bitbucket instance then the link relations are in @@ -708,7 +704,7 @@ instead implement something more powerful, though also more opinionated. again that you already have. Other arguments behave as for ‘ghub-graphql’ and ‘ghub-request’, - more or less. If ‘CALLBACK’ is nil, pretty-print the response. + more or less. If ‘CALLBACK’ is ‘nil’, pretty-print the response. Using ‘ghub--graphql-vacuum’, the following resource specific functions are implemented. These functions are not part of the public @@ -741,7 +737,7 @@ unpaginating, but as demonstrated here they can be useful even before making an initial request.  -File: ghub.info, Node: Github Convenience Wrappers, Next: Non-Github Convenience Wrappers, Prev: Making GraphQL Requests, Up: API +File: ghub.info, Node: Github Convenience Wrappers, Prev: Making GraphQL Requests, Up: API 3.4 Github Convenience Wrappers =============================== @@ -814,114 +810,6 @@ File: ghub.info, Node: Github Convenience Wrappers, Next: Non-Github Convenien See ‘ghub-request’’s documentation above for information about the other arguments. - -File: ghub.info, Node: Non-Github Convenience Wrappers, Prev: Github Convenience Wrappers, Up: API - -3.5 Non-Github Convenience Wrappers -=================================== - -‘ghub-request’ and ‘ghub-METHOD’ can be used to make a request for any -of the supported forge types, but except when making a request for a -‘github’ instance, then that requires the use of the FORGE argument. - - To avoid that, functions named ‘FORGE-request’ and ‘FORGE-METHOD’ are -also available. The following forms are equivalent, for example: - - (ghub-get ... :auth 'PACKAGE :forge 'gitlab) - (glab-get ... :auth 'PACKAGE) - - These forms would remain equivalent even if you did not specify a -value for the AUTH arguments — but you should not do that if you plan to -share your code with others (see *note Using Ghub in Your Own -Package::). If you do omit AUTH, then the request is made on behalf of -the ‘ghub’ package, *regardless* of the symbol prefix of the function -you use to do so. - - All ‘FORGE-request’ and ‘FORGE-METHOD’ functions, including but not -limited to ‘ghub-METHOD’, are very simple wrappers around -‘ghub-request’. They take fewer arguments than ‘ghub-request’ and -instead pass constant values for the arguments METHOD and/or FORGE. - - -- Function: buck-request resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-request resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-request resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - Wrappers around ‘ghub-request’ which hardcode the FORGE to either - ‘bitbucket’, ‘gitlab’, ‘gogs’ or ‘gitea’. - - -- Function: buck-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: buck-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: buck-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: buck-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-head resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - Wrappers around ‘FORGE-METHOD’ which hardcode the FORGE to either - ‘bitbucket’, ‘gitlab’, ‘gogs’ or ‘gitea’, and the METHOD to the - implied method. - - Note that ‘buck-head’, ‘buck-patch’, ‘gogs-head’ and ‘gtea-head’ do - not exist because the respective APIs do not appear to support - these methods. -  File: ghub.info, Node: Notes, Next: Function Index, Prev: API, Up: Top @@ -1002,7 +890,8 @@ File: ghub.info, Node: Forge Limitations and Notes, Prev: Using Ghub in Your O • Where one would use ‘user/repo’ when accessing another forge, one has to use ‘user%2Frepo’ when accessing Gitlab, e.g.: - (glab-get "/projects/python-mode-devs%2Fpython-mode") + (ghub-get "/projects/python-mode-devs%2Fpython-mode" + nil :forge 'gitlab)  File: ghub.info, Node: Function Index, Next: Variable Index, Prev: Notes, Up: Top @@ -1013,20 +902,10 @@ Appendix A Function Index [index] * Menu: -* buck-delete: Non-Github Convenience Wrappers. - (line 49) -* buck-get: Non-Github Convenience Wrappers. - (line 40) -* buck-post: Non-Github Convenience Wrappers. - (line 46) -* buck-put: Non-Github Convenience Wrappers. - (line 43) -* buck-request: Non-Github Convenience Wrappers. - (line 28) * ghub--graphql-vacuum: Making GraphQL Requests. (line 56) * ghub-continue: Making REST Requests. - (line 125) + (line 122) * ghub-delete: Github Convenience Wrappers. (line 31) * ghub-fetch-issue: Making GraphQL Requests. @@ -1050,45 +929,9 @@ Appendix A Function Index * ghub-request: Making REST Requests. (line 6) * ghub-response-link-relations: Making REST Requests. - (line 174) + (line 172) * ghub-wait: Github Convenience Wrappers. (line 44) -* glab-delete: Non-Github Convenience Wrappers. - (line 67) -* glab-get: Non-Github Convenience Wrappers. - (line 55) -* glab-head: Non-Github Convenience Wrappers. - (line 52) -* glab-patch: Non-Github Convenience Wrappers. - (line 64) -* glab-post: Non-Github Convenience Wrappers. - (line 61) -* glab-put: Non-Github Convenience Wrappers. - (line 58) -* glab-request: Non-Github Convenience Wrappers. - (line 31) -* gogs-delete: Non-Github Convenience Wrappers. - (line 82) -* gogs-get: Non-Github Convenience Wrappers. - (line 70) -* gogs-patch: Non-Github Convenience Wrappers. - (line 79) -* gogs-post: Non-Github Convenience Wrappers. - (line 76) -* gogs-put: Non-Github Convenience Wrappers. - (line 73) -* gogs-request: Non-Github Convenience Wrappers. - (line 34) -* gtea-delete: Non-Github Convenience Wrappers. - (line 97) -* gtea-get: Non-Github Convenience Wrappers. - (line 85) -* gtea-patch: Non-Github Convenience Wrappers. - (line 94) -* gtea-post: Non-Github Convenience Wrappers. - (line 91) -* gtea-put: Non-Github Convenience Wrappers. - (line 88)  File: ghub.info, Node: Variable Index, Prev: Function Index, Up: Top @@ -1100,7 +943,7 @@ Appendix B Variable Index * Menu: * ghub-response-headers: Making REST Requests. - (line 165) + (line 163) * github.host: Github Configuration Variables. (line 26) * github.HOST.user: Github Configuration Variables. @@ -1112,30 +955,29 @@ Appendix B Variable Index  Tag Table: Node: Top773 -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 +Node: Introduction2207 +Node: Getting Started2612 +Node: Basic Concepts Arguments and Variables3639 +Node: Setting the Username7643 +Ref: Setting your Githubcom Username8131 +Ref: Setting your Gitlabcom Username8487 +Ref: Setting your Github Enterprise Username8953 +Ref: Setting your Username for Other Hosts and/or Forges9686 +Node: Creating and Storing a Token10492 +Ref: Creating a Token10705 +Ref: Storing a Token11622 +Node: Github Configuration Variables13365 +Node: API15076 +Node: Their APIs15278 +Node: Making REST Requests15960 +Node: Making GraphQL Requests25270 +Node: Github Convenience Wrappers31959 +Node: Notes35623 +Node: Using Ghub in Personal Scripts35830 +Node: Using Ghub in Your Own Package36721 +Node: Forge Limitations and Notes37656 +Node: Function Index38668 +Node: Variable Index40936  End Tag Table diff --git a/elpa/ghub-20250509.1440/gsexp.el b/elpa/ghub-20251130.1842/gsexp.el similarity index 100% rename from elpa/ghub-20250509.1440/gsexp.el rename to elpa/ghub-20251130.1842/gsexp.el -- 2.47.3