Function: majutsu-diff--parse-revision-metadata
majutsu-diff--parse-revision-metadata is a natively compiled function
defined in majutsu-diff.el.
Signature
(majutsu-diff--parse-revision-metadata OUTPUT)
Documentation
Parse one NUL-framed revision metadata record from OUTPUT.
Return a plist, or nil for malformed output and revsets resolving to zero or multiple changes. Each field is JSON, so NUL, terminal escapes, and other control characters remain data while externally applied jj labels survive as Emacs presentation properties.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-diff--parse-revision-metadata (output)
"Parse one NUL-framed revision metadata record from OUTPUT.
Return a plist, or nil for malformed output and revsets resolving to zero
or multiple changes. Each field is JSON, so NUL, terminal escapes, and other
control characters remain data while externally applied jj labels survive as
Emacs presentation properties."
(condition-case nil
(let* ((ansi-color-apply-face-function
#'ansi-color-apply-text-property-face)
(colored (ansi-color-apply (or output "")))
(tokens (majutsu--split-fields
colored majutsu-diff--revision-metadata-separator)))
(when (and (= (length tokens)
(1+ majutsu-diff--revision-metadata-field-count))
(string-empty-p (car (last tokens))))
(let ((record
(vconcat
(mapcar #'majutsu-diff--decode-metadata-token
(butlast tokens)))))
(pcase-let ((`[,change-id ,local ,remote ,commit-id
,author-name ,author-email ,author-date
,committer-name ,committer-email ,committer-date
,description]
record))
(when (and (seq-every-p
#'stringp
(list change-id commit-id
author-name author-email author-date
committer-name committer-email committer-date
description))
(vectorp local)
(seq-every-p #'stringp local)
(vectorp remote)
(seq-every-p
(lambda (pair)
(and (vectorp pair)
(= (length pair) 2)
(stringp (aref pair 0))
(stringp (aref pair 1))))
remote))
(list :change-id change-id
:local-bookmarks (append local nil)
:remote-bookmarks
(mapcar (lambda (pair) (append pair nil)) remote)
:commit-id commit-id
:author-name author-name
:author-email author-email
:author-date author-date
:committer-name committer-name
:committer-email committer-email
:committer-date committer-date
:description description))))))
(error nil)))