Function: majutsu-gerrit-remote-branch-candidate-data
majutsu-gerrit-remote-branch-candidate-data is a natively compiled
function defined in majutsu-gerrit.el.
Signature
(majutsu-gerrit-remote-branch-candidate-data &optional REMOTE)
Documentation
Return completion payload for Gerrit remote branch names.
When REMOTE is non-nil, only branches from that remote are returned.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-gerrit.el
;;;###autoload
(defun majutsu-gerrit-remote-branch-candidate-data (&optional remote)
"Return completion payload for Gerrit remote branch names.
When REMOTE is non-nil, only branches from that remote are returned."
(majutsu-with-toplevel
(let ((sources (make-hash-table :test #'equal))
(entries (make-hash-table :test #'equal))
(annotations (make-hash-table :test #'equal)))
(condition-case _
(dolist (line (apply #'majutsu-jj-lines
(append (list "bookmark" "list" "--quiet")
(if remote
(list "--remote" remote)
'("--all-remotes"))
(list "-T" majutsu-gerrit--remote-branch-template))))
(pcase-let ((`(,name ,source . ,_)
(split-string (substring-no-properties line) "\t")))
(when (and name source
(not (string-empty-p name))
(not (string-empty-p source)))
(puthash name
(majutsu--append-unique (gethash name sources) source)
sources))))
(error nil))
(let ((candidates (sort (hash-table-keys sources) #'string<)))
(dolist (candidate candidates)
(let ((entry (majutsu-gerrit--remote-branch-entry
candidate (gethash candidate sources))))
(puthash candidate entry entries)
(puthash candidate
(format "remote%s: %s"
(if (cdr (plist-get entry :remotes)) "s" "")
(string-join (plist-get entry :remotes) ","))
annotations)))
(list :category 'majutsu-gerrit-remote-branch
:candidates candidates
:entries entries
:annotations annotations
:annotation-suffix-function
(majutsu-completion-entry-suffix-function
entries #'majutsu-gerrit--remote-branch-suffix))))))