update packages
This commit is contained in:
@@ -31,8 +31,7 @@
|
||||
(require 'magit-core)
|
||||
(require 'magit-diff)
|
||||
|
||||
(declare-function magit--any-wip-mode-enabled-p "magit-wip" ())
|
||||
(declare-function magit-blob-visit "magit-files" (blob-or-file))
|
||||
(declare-function magit-blob-visit "magit-files" (rev file))
|
||||
(declare-function magit-cherry-apply "magit-sequence" (commit &optional args))
|
||||
(declare-function magit-insert-head-branch-header "magit-status"
|
||||
(&optional branch))
|
||||
@@ -48,9 +47,10 @@
|
||||
(defvar magit-refs-focus-column-width)
|
||||
(defvar magit-refs-margin)
|
||||
(defvar magit-refs-show-commit-count)
|
||||
(defvar magit-buffer-margin)
|
||||
(defvar magit--right-margin-config)
|
||||
(defvar magit-status-margin)
|
||||
(defvar magit-status-sections-hook)
|
||||
(defvar magit-status-use-buffer-arguments)
|
||||
|
||||
(require 'ansi-color)
|
||||
(require 'crm)
|
||||
@@ -170,6 +170,23 @@ want to use the same functions for both hooks."
|
||||
:options (list #'magit-highlight-squash-markers
|
||||
#'magit-highlight-bracket-keywords))
|
||||
|
||||
(defcustom magit-log-trailer-labels nil
|
||||
"Whether and how to insert labels, derived from commit message trailers.
|
||||
|
||||
If non-nil, the value has the form (FUNCTION . OPTIONS). FUNCTION is
|
||||
called with one argument, the trailers as an alist, and should return a
|
||||
string, which is then inserted in between the refnames and the message,
|
||||
or nil. OPTIONS specifies additional options for \"%(trailers)\". You
|
||||
should probably use something like \"key=KEY1,key=KEY2,only=true\".
|
||||
\"unfold=true,separator=^^,key_value_separator=^_\" is always appended
|
||||
to the options specified here. See the git-log(1) manpage."
|
||||
:package-version '(magit . "4.4.1")
|
||||
:group 'magit-log
|
||||
:type '(choice (const :tag "Ignore trailers" nil)
|
||||
(cons :tag "Process trailers"
|
||||
(function :tag "Formatting function")
|
||||
(string :tag "Options for %%(trailers)"))))
|
||||
|
||||
(defcustom magit-log-header-line-function #'magit-log-header-line-sentence
|
||||
"Function used to generate text shown in header line of log buffers."
|
||||
:package-version '(magit . "2.12.0")
|
||||
@@ -370,11 +387,15 @@ commits before and half after."
|
||||
|
||||
;;;; Prefix Methods
|
||||
|
||||
(cl-defmethod transient-prefix-value ((obj magit-log-prefix))
|
||||
(let ((args (cl-call-next-method obj)))
|
||||
(list (seq-filter #'atom args)
|
||||
(cdr (assoc "--" args)))))
|
||||
|
||||
(cl-defmethod transient-init-value ((obj magit-log-prefix))
|
||||
(pcase-let ((`(,args ,files)
|
||||
(magit-log--get-value 'magit-log-mode
|
||||
magit-prefix-use-buffer-arguments)))
|
||||
(when-let (((not (eq transient-current-command 'magit-dispatch)))
|
||||
(magit-log--get-value 'magit-log-mode 'prefix)))
|
||||
(when-let ((_(not (eq transient-current-command 'magit-dispatch)))
|
||||
(file (magit-file-relative-name)))
|
||||
(setq files (list file)))
|
||||
(oset obj value (if files `(("--" ,@files) ,@args) args))))
|
||||
@@ -396,40 +417,38 @@ commits before and half after."
|
||||
(defun magit-log-arguments (&optional mode)
|
||||
"Return the current log arguments."
|
||||
(if (memq transient-current-command '(magit-log magit-log-refresh))
|
||||
(magit--transient-args-and-files)
|
||||
(magit-log--get-value (or mode 'magit-log-mode))))
|
||||
(transient-args transient-current-command)
|
||||
(magit-log--get-value (or mode 'magit-log-mode) 'direct)))
|
||||
|
||||
(defun magit-log--get-value (mode &optional use-buffer-args)
|
||||
(unless use-buffer-args
|
||||
(setq use-buffer-args magit-direct-use-buffer-arguments))
|
||||
(let (args files)
|
||||
(cond
|
||||
((and (memq use-buffer-args '(always selected current))
|
||||
(eq major-mode mode))
|
||||
(setq args magit-buffer-log-args)
|
||||
(setq files magit-buffer-log-files))
|
||||
((when-let (((memq use-buffer-args '(always selected)))
|
||||
(buffer (magit-get-mode-buffer
|
||||
mode nil
|
||||
(eq use-buffer-args 'selected))))
|
||||
(setq args (buffer-local-value 'magit-buffer-log-args buffer))
|
||||
(setq files (buffer-local-value 'magit-buffer-log-files buffer))
|
||||
t))
|
||||
((plist-member (symbol-plist mode) 'magit-log-current-arguments)
|
||||
(setq args (get mode 'magit-log-current-arguments)))
|
||||
((when-let ((elt (assq (intern (format "magit-log:%s" mode))
|
||||
transient-values)))
|
||||
(setq args (cdr elt))
|
||||
t))
|
||||
(t
|
||||
(setq args (get mode 'magit-log-default-arguments))))
|
||||
(list args files)))
|
||||
(setq use-buffer-args
|
||||
(pcase-exhaustive use-buffer-args
|
||||
('prefix magit-prefix-use-buffer-arguments)
|
||||
('status magit-status-use-buffer-arguments)
|
||||
('direct magit-direct-use-buffer-arguments)
|
||||
('nil magit-direct-use-buffer-arguments)
|
||||
((or 'always 'selected 'current 'never)
|
||||
use-buffer-args)))
|
||||
(cond-let
|
||||
((and (memq use-buffer-args '(always selected current))
|
||||
(eq major-mode mode))
|
||||
(list magit-buffer-log-args
|
||||
magit-buffer-log-files))
|
||||
([_(memq use-buffer-args '(always selected))]
|
||||
[buffer (magit-get-mode-buffer mode nil (eq use-buffer-args 'selected))]
|
||||
(list (buffer-local-value 'magit-buffer-log-args buffer)
|
||||
(buffer-local-value 'magit-buffer-log-files buffer)))
|
||||
((plist-member (symbol-plist mode) 'magit-log-current-arguments)
|
||||
(list (get mode 'magit-log-current-arguments) nil))
|
||||
([elt (assq (intern (format "magit-log:%s" mode)) transient-values)]
|
||||
(list (cdr elt) nil))
|
||||
((list (get mode 'magit-log-default-arguments) nil))))
|
||||
|
||||
(defun magit-log--set-value (obj &optional save)
|
||||
(pcase-let* ((obj (oref obj prototype))
|
||||
(mode (or (oref obj major-mode) major-mode))
|
||||
(key (intern (format "magit-log:%s" mode)))
|
||||
(`(,args ,files) (magit--transient-args-and-files)))
|
||||
(`(,args ,files) (transient-args (oref obj command))))
|
||||
(put mode 'magit-log-current-arguments args)
|
||||
(when save
|
||||
(setf (alist-get key transient-values) args)
|
||||
@@ -494,7 +513,7 @@ commits before and half after."
|
||||
(eq major-mode 'magit-log-mode)
|
||||
t))
|
||||
|
||||
;;;###autoload (autoload 'magit-log "magit-log" nil t)
|
||||
;;;###autoload(autoload 'magit-log "magit-log" nil t)
|
||||
(transient-define-prefix magit-log ()
|
||||
"Show a commit or reference log."
|
||||
:man-page "git-log"
|
||||
@@ -516,14 +535,14 @@ commits before and half after."
|
||||
("r" "current" magit-reflog-current)
|
||||
("O" "other" magit-reflog-other)
|
||||
("H" "HEAD" magit-reflog-head)]
|
||||
[:if magit--any-wip-mode-enabled-p
|
||||
[:if-mode magit-wip-mode
|
||||
:description "Wiplog"
|
||||
("i" "index" magit-wip-log-index)
|
||||
("w" "worktree" magit-wip-log-worktree)]
|
||||
["Other"
|
||||
("s" "shortlog" magit-shortlog)]])
|
||||
|
||||
;;;###autoload (autoload 'magit-log-refresh "magit-log" nil t)
|
||||
;;;###autoload(autoload 'magit-log-refresh "magit-log" nil t)
|
||||
(transient-define-prefix magit-log-refresh ()
|
||||
"Change the arguments used for the log(s) in the current buffer."
|
||||
:man-page "git-log"
|
||||
@@ -639,13 +658,13 @@ commits before and half after."
|
||||
"SPC" #'self-insert-command)
|
||||
|
||||
(defun magit-log-read-revs (&optional use-current)
|
||||
(or (and use-current (and-let* ((buf (magit-get-current-branch))) (list buf)))
|
||||
(or (and use-current (and$ (magit-get-current-branch) (list $)))
|
||||
(let ((crm-separator "\\(\\.\\.\\.?\\|[, ]\\)")
|
||||
(crm-local-completion-map magit-log-read-revs-map))
|
||||
(split-string (magit-completing-read-multiple
|
||||
"Log rev,s: "
|
||||
(magit-list-refnames nil t)
|
||||
nil nil nil 'magit-revision-history
|
||||
nil 'any nil 'magit-revision-history
|
||||
(or (magit-branch-or-commit-at-point)
|
||||
(and (not use-current)
|
||||
(magit-get-previous-branch)))
|
||||
@@ -656,7 +675,7 @@ commits before and half after."
|
||||
"Read a string from the user to pass as parameter to OPTION."
|
||||
(magit-read-string (format "Type a pattern to pass to %s" option)))
|
||||
|
||||
;;;###autoload (autoload 'magit-log-current "magit-log" nil t)
|
||||
;;;###autoload(autoload 'magit-log-current "magit-log" nil t)
|
||||
(transient-define-suffix magit-log-current (&optional args files)
|
||||
"Show log for the current branch, or `HEAD' if no branch is checked out."
|
||||
:description (##if (magit-get-current-branch) "current" "HEAD")
|
||||
@@ -722,18 +741,18 @@ completion candidates."
|
||||
;;;###autoload
|
||||
(defun magit-log-matching-branches (pattern &optional args files)
|
||||
"Show log for all branches matching PATTERN and `HEAD'."
|
||||
(interactive (cons (magit-log-read-pattern "--branches") (magit-log-arguments)))
|
||||
(magit-log-setup-buffer
|
||||
(list "HEAD" (format "--branches=%s" pattern))
|
||||
args files))
|
||||
(interactive (cons (magit-log-read-pattern "--branches")
|
||||
(magit-log-arguments)))
|
||||
(magit-log-setup-buffer (list "HEAD" (format "--branches=%s" pattern))
|
||||
args files))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-log-matching-tags (pattern &optional args files)
|
||||
"Show log for all tags matching PATTERN and `HEAD'."
|
||||
(interactive (cons (magit-log-read-pattern "--tags") (magit-log-arguments)))
|
||||
(magit-log-setup-buffer
|
||||
(list "HEAD" (format "--tags=%s" pattern))
|
||||
args files))
|
||||
(interactive (cons (magit-log-read-pattern "--tags")
|
||||
(magit-log-arguments)))
|
||||
(magit-log-setup-buffer (list "HEAD" (format "--tags=%s" pattern))
|
||||
args files))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-log-all-branches (&optional args files)
|
||||
@@ -748,10 +767,7 @@ completion candidates."
|
||||
(defun magit-log-all (&optional args files)
|
||||
"Show log for all references and `HEAD'."
|
||||
(interactive (magit-log-arguments))
|
||||
(magit-log-setup-buffer (if (magit-get-current-branch)
|
||||
(list "--all")
|
||||
(list "HEAD" "--all"))
|
||||
args files))
|
||||
(magit-log-setup-buffer (list "--all") args files))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-log-buffer-file (&optional follow beg end)
|
||||
@@ -865,6 +881,13 @@ https://github.com/mhagger/git-when-merged."
|
||||
(user-error "Could not find when %s was merged into %s: %s"
|
||||
commit branch m)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-delete-shelved-branch (branch)
|
||||
"Delete the shelved BRANCH.
|
||||
Delete a ref created by `magit-branch-shelve'."
|
||||
(interactive (list (magit-read-shelved-branch "Log shelved branch")))
|
||||
(magit-run-git "update-ref" "-d" (concat "refs/shelved/" branch)))
|
||||
|
||||
;;;; Limit Commands
|
||||
|
||||
(defun magit-log-toggle-commit-limit ()
|
||||
@@ -887,7 +910,7 @@ limit. Otherwise set it to 256."
|
||||
(defun magit-log-set-commit-limit (fn)
|
||||
(let* ((val magit-buffer-log-args)
|
||||
(arg (seq-find (##string-match "^-n\\([0-9]+\\)?$" %) val))
|
||||
(num (and arg (string-to-number (match-string 1 arg))))
|
||||
(num (and arg (string-to-number (match-str 1 arg))))
|
||||
(num (if num (funcall fn num 2) 256)))
|
||||
(setq val (remove arg val))
|
||||
(setq magit-buffer-log-args
|
||||
@@ -897,9 +920,9 @@ limit. Otherwise set it to 256."
|
||||
(magit-refresh))
|
||||
|
||||
(defun magit-log-get-commit-limit (&optional args)
|
||||
(and-let* ((str (seq-find (##string-match "^-n\\([0-9]+\\)?$" %)
|
||||
(or args magit-buffer-log-args))))
|
||||
(string-to-number (match-string 1 str))))
|
||||
(and$ (seq-find (##string-match "^-n\\([0-9]+\\)?$" %)
|
||||
(or args magit-buffer-log-args))
|
||||
(string-to-number (match-str 1 $))))
|
||||
|
||||
;;;; Mode Commands
|
||||
|
||||
@@ -909,15 +932,15 @@ Like `magit-mode-bury-buffer' (which see) but with a negative
|
||||
prefix argument instead bury the revision buffer, provided it
|
||||
is displayed in the current frame."
|
||||
(interactive "p")
|
||||
(if (< arg 0)
|
||||
(let* ((buf (magit-get-mode-buffer 'magit-revision-mode))
|
||||
(win (and buf (get-buffer-window buf (selected-frame)))))
|
||||
(if win
|
||||
(with-selected-window win
|
||||
(with-current-buffer buf
|
||||
(magit-mode-bury-buffer (> (abs arg) 1))))
|
||||
(user-error "No revision buffer in this frame")))
|
||||
(magit-mode-bury-buffer (> arg 1))))
|
||||
(cond-let*
|
||||
((>= arg 0)
|
||||
(magit-mode-bury-buffer (> arg 1)))
|
||||
([buf (magit-get-mode-buffer 'magit-revision-mode)]
|
||||
[win (get-buffer-window buf (selected-frame))]
|
||||
(with-selected-window win
|
||||
(with-current-buffer buf
|
||||
(magit-mode-bury-buffer (> (abs arg) 1)))))
|
||||
((user-error "No revision buffer in this frame"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-log-move-to-parent (&optional n)
|
||||
@@ -947,27 +970,25 @@ nothing else.
|
||||
If invoked outside any log buffer, then display the log buffer
|
||||
of the current repository first; creating it if necessary."
|
||||
(interactive
|
||||
(list (or (magit-completing-read
|
||||
"In log, jump to"
|
||||
(magit-list-refnames nil t)
|
||||
nil nil nil 'magit-revision-history
|
||||
(or (and-let* ((rev (magit-commit-at-point)))
|
||||
(magit-rev-fixup-target rev))
|
||||
(magit-get-current-branch)))
|
||||
(user-error "Nothing selected"))))
|
||||
(list (magit-completing-read
|
||||
"In log, jump to"
|
||||
(magit-list-refnames nil t)
|
||||
nil 'any nil 'magit-revision-history
|
||||
(or (and$ (magit-commit-at-point)
|
||||
(magit-rev-fixup-target $))
|
||||
(magit-get-current-branch)))))
|
||||
(with-current-buffer
|
||||
(cond ((derived-mode-p 'magit-log-mode)
|
||||
(current-buffer))
|
||||
((and-let* ((buf (magit-get-mode-buffer 'magit-log-mode)))
|
||||
(pop-to-buffer-same-window buf)))
|
||||
(t
|
||||
(apply #'magit-log-all-branches (magit-log-arguments))))
|
||||
((and$ (magit-get-mode-buffer 'magit-log-mode)
|
||||
(pop-to-buffer-same-window $)))
|
||||
((apply #'magit-log-all-branches (magit-log-arguments))))
|
||||
(unless (magit-log-goto-commit-section (magit-rev-abbrev commit))
|
||||
(user-error "%s isn't visible in the current log buffer" commit))))
|
||||
|
||||
;;;; Shortlog Commands
|
||||
|
||||
;;;###autoload (autoload 'magit-shortlog "magit-log" nil t)
|
||||
;;;###autoload(autoload 'magit-shortlog "magit-log" nil t)
|
||||
(transient-define-prefix magit-shortlog ()
|
||||
"Show a history summary."
|
||||
:man-page "git-shortlog"
|
||||
@@ -1203,6 +1224,19 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(declare (obsolete magit--insert-log "Magit 4.0.0"))
|
||||
(magit--insert-log nil revs args files))
|
||||
|
||||
(defconst magit-log-heading-format
|
||||
;; See `magit-log-heading-re'.
|
||||
(concat "--format="
|
||||
"%s" ; 4 graph --graph
|
||||
"%%h%%x0c" ; 1 %h hash
|
||||
"%s%%x0c" ; 3 %D refs --decorate
|
||||
"%s%%x0c" ; 7 %G? gpg --show-signature
|
||||
"%%aN%%x0c" ; 5 %aN author
|
||||
"%s%%x0c" ; 6 %at date magit-log-margin-show-committer-date
|
||||
"%s%%x0c" ; 12 %() trailers magit-log-trailer-labels
|
||||
"%%s" ; 2 %s msg
|
||||
"%s")) ; \n .. headers magit-log-revision-headers-format
|
||||
|
||||
(defun magit--insert-log (keep-error revs &optional args files)
|
||||
"Insert a log section.
|
||||
Do not add this to a hook variable."
|
||||
@@ -1212,7 +1246,7 @@ Do not add this to a hook variable."
|
||||
(remove "--literal-pathspecs" magit-git-global-arguments)))
|
||||
(magit--git-wash (apply-partially #'magit-log-wash-log 'log) keep-error
|
||||
"log"
|
||||
(format "--format=%s%%h%%x0c%s%%x0c%s%%x0c%%aN%%x0c%s%%x0c%%s%s"
|
||||
(format magit-log-heading-format
|
||||
(if (and (member "--left-right" args)
|
||||
(not (member "--graph" args)))
|
||||
"%m "
|
||||
@@ -1235,6 +1269,13 @@ Do not add this to a hook variable."
|
||||
"")
|
||||
("%G?"))))
|
||||
(if magit-log-margin-show-committer-date "%ct" "%at")
|
||||
(if magit-log-trailer-labels
|
||||
(format "%%(trailers:%s%s)"
|
||||
(if (not (equal (cdr magit-log-trailer-labels) ""))
|
||||
(concat (cdr magit-log-trailer-labels) ",")
|
||||
"")
|
||||
"unfold=true,separator=,key_value_separator=")
|
||||
"")
|
||||
(if (member "++header" args)
|
||||
(if (member "--graph" (setq args (remove "++header" args)))
|
||||
(concat "\n" magit-log-revision-headers-format "\n")
|
||||
@@ -1243,7 +1284,7 @@ Do not add this to a hook variable."
|
||||
(progn
|
||||
(when-let ((order (seq-find (##string-match "^\\+\\+order=\\(.+\\)$" %)
|
||||
args)))
|
||||
(setq args (cons (format "--%s-order" (match-string 1 order))
|
||||
(setq args (cons (format "--%s-order" (match-str 1 order))
|
||||
(remove order args))))
|
||||
(when (member "--decorate" args)
|
||||
(setq args (cons "--decorate=full" (remove "--decorate" args))))
|
||||
@@ -1271,18 +1312,20 @@ Do not add this to a hook variable."
|
||||
:parent magit-commit-section-map)
|
||||
|
||||
(defconst magit-log-heading-re
|
||||
;; Note: A form feed instead of a null byte is used as the delimiter
|
||||
;; because using the latter interferes with the graph prefix when
|
||||
;; ++header is used.
|
||||
;; Use a form feed instead of a null byte as the delimiter because using
|
||||
;; the latter interferes with the graph prefix when ++header is used.
|
||||
(concat "^"
|
||||
"\\(?4:[-_/|\\*o<>. ]*\\)" ; graph
|
||||
"\\(?1:[0-9a-fA-F]+\\)?" ; hash
|
||||
"\\(?3:[^\n]+\\)?" ; refs
|
||||
"\\(?7:[BGUXYREN]\\)?" ; gpg
|
||||
"\\(?5:[^\n]*\\)" ; author
|
||||
;; Note: Date is optional because, prior to Git v2.19.0,
|
||||
;; `git rebase -i --root` corrupts the root's author date.
|
||||
;; Prior to Git v2.19.0, "git rebase -i --root" corrupted the
|
||||
;; root's author date. Keep date optional because even though
|
||||
;; we no longer support such old releases, the roots they create
|
||||
;; may live on.
|
||||
"\\(?6:[^\n]*\\)" ; date
|
||||
"\\(?12:[^\n]+\\)?" ; trailers
|
||||
"\\(?2:.*\\)$")) ; msg
|
||||
|
||||
(defconst magit-log-cherry-re
|
||||
@@ -1376,129 +1419,145 @@ Do not add this to a hook variable."
|
||||
('stash magit-log-stash-re)
|
||||
('bisect-vis magit-log-bisect-vis-re)
|
||||
('bisect-log magit-log-bisect-log-re)))
|
||||
(magit-bind-match-strings
|
||||
(hash msg refs graph author date gpg cherry _ refsub side) nil
|
||||
(setq msg (substring-no-properties msg))
|
||||
(when refs
|
||||
(setq refs (substring-no-properties refs)))
|
||||
(let ((align (or (eq style 'cherry)
|
||||
(not (member "--stat" magit-buffer-log-args))))
|
||||
(non-graph-re (if (eq style 'bisect-vis)
|
||||
magit-log-bisect-vis-re
|
||||
magit-log-heading-re)))
|
||||
(magit-delete-line)
|
||||
;; If the reflog entries have been pruned, the output of `git
|
||||
;; reflog show' includes a partial line that refers to the hash
|
||||
;; of the youngest expired reflog entry.
|
||||
(when (and (eq style 'reflog) (not date))
|
||||
(cl-return-from magit-log-wash-rev t))
|
||||
(magit-insert-section
|
||||
((eval (pcase style
|
||||
('stash 'stash)
|
||||
('module 'module-commit)
|
||||
(_ 'commit)))
|
||||
hash)
|
||||
(setq hash (propertize (if (eq style 'bisect-log)
|
||||
(magit-rev-parse "--short" hash)
|
||||
hash)
|
||||
'font-lock-face
|
||||
(pcase (and gpg (aref gpg 0))
|
||||
(?G 'magit-signature-good)
|
||||
(?B 'magit-signature-bad)
|
||||
(?U 'magit-signature-untrusted)
|
||||
(?X 'magit-signature-expired)
|
||||
(?Y 'magit-signature-expired-key)
|
||||
(?R 'magit-signature-revoked)
|
||||
(?E 'magit-signature-error)
|
||||
(?N 'magit-hash)
|
||||
(_ 'magit-hash))))
|
||||
(when cherry
|
||||
(when (and (derived-mode-p 'magit-refs-mode)
|
||||
magit-refs-show-commit-count)
|
||||
(insert (make-string (1- magit-refs-focus-column-width) ?\s)))
|
||||
(insert (propertize cherry 'font-lock-face
|
||||
(if (string= cherry "-")
|
||||
'magit-cherry-equivalent
|
||||
'magit-cherry-unmatched)))
|
||||
(insert ?\s))
|
||||
(when side
|
||||
(insert (propertize side 'font-lock-face
|
||||
(if (string= side "<")
|
||||
'magit-cherry-equivalent
|
||||
'magit-cherry-unmatched)))
|
||||
(insert ?\s))
|
||||
(when align
|
||||
(insert hash ?\s))
|
||||
(when graph
|
||||
(insert graph))
|
||||
(unless align
|
||||
(insert hash ?\s))
|
||||
(when (and refs (not magit-log-show-refname-after-summary))
|
||||
(insert (magit-format-ref-labels refs) ?\s))
|
||||
(when (eq style 'reflog)
|
||||
(insert (format "%-2s " (1- magit-log-count)))
|
||||
(when refsub
|
||||
(insert (magit-reflog-format-subject
|
||||
(substring refsub 0
|
||||
(if (string-search ":" refsub) -2 -1))))))
|
||||
(insert (magit-log--wash-summary msg))
|
||||
(when (and refs magit-log-show-refname-after-summary)
|
||||
(insert ?\s)
|
||||
(insert (magit-format-ref-labels refs)))
|
||||
(insert ?\n)
|
||||
(when (memq style '(log reflog stash))
|
||||
(goto-char (line-beginning-position))
|
||||
(when (and refsub
|
||||
(string-match "\\`\\([^ ]\\) \\+\\(..\\)\\(..\\)" date))
|
||||
(setq date (+ (string-to-number (match-string 1 date))
|
||||
(* (string-to-number (match-string 2 date)) 60 60)
|
||||
(* (string-to-number (match-string 3 date)) 60))))
|
||||
(magit-log-format-margin hash author date))
|
||||
(when (and (eq style 'cherry)
|
||||
(magit-buffer-margin-p))
|
||||
(apply #'magit-log-format-margin hash
|
||||
(split-string (magit-rev-format "%aN%x00%ct" hash) "\0")))
|
||||
(when (and graph
|
||||
(not (eobp))
|
||||
(not (looking-at non-graph-re)))
|
||||
(when (looking-at "")
|
||||
(let* ((hash (match-str 1))
|
||||
(msg (match-str 2))
|
||||
(refs (match-str 3))
|
||||
(refs (and refs (magit-format-ref-labels refs)))
|
||||
(graph (match-string 4))
|
||||
(author (match-str 5))
|
||||
(date (match-str 6))
|
||||
(gpg (match-str 7))
|
||||
(cherry (match-str 8))
|
||||
(refsub (match-str 10))
|
||||
(side (match-str 11))
|
||||
(trailers (match-str 12))
|
||||
(trailers (and trailers
|
||||
(funcall (car magit-log-trailer-labels)
|
||||
(mapcar (##split-string % "")
|
||||
(split-string trailers "")))))
|
||||
(align (or (eq style 'cherry)
|
||||
(not (member "--stat" magit-buffer-log-args))))
|
||||
(non-graph-re (if (eq style 'bisect-vis)
|
||||
magit-log-bisect-vis-re
|
||||
magit-log-heading-re)))
|
||||
(magit-delete-line)
|
||||
;; If the reflog entries have been pruned, the output of `git
|
||||
;; reflog show' includes a partial line that refers to the hash
|
||||
;; of the youngest expired reflog entry.
|
||||
(when (and (eq style 'reflog) (not date))
|
||||
(cl-return-from magit-log-wash-rev t))
|
||||
(magit-insert-section
|
||||
((eval (pcase style
|
||||
('stash 'stash)
|
||||
('module 'module-commit)
|
||||
(_ 'commit)))
|
||||
hash)
|
||||
(setq hash (propertize (if (eq style 'bisect-log)
|
||||
(magit-rev-parse "--short" hash)
|
||||
hash)
|
||||
'font-lock-face
|
||||
(pcase (and gpg (aref gpg 0))
|
||||
(?G 'magit-signature-good)
|
||||
(?B 'magit-signature-bad)
|
||||
(?U 'magit-signature-untrusted)
|
||||
(?X 'magit-signature-expired)
|
||||
(?Y 'magit-signature-expired-key)
|
||||
(?R 'magit-signature-revoked)
|
||||
(?E 'magit-signature-error)
|
||||
(?N 'magit-hash)
|
||||
(_ 'magit-hash))))
|
||||
(when cherry
|
||||
(when (and (derived-mode-p 'magit-refs-mode)
|
||||
magit-refs-show-commit-count)
|
||||
(insert (make-string (1- magit-refs-focus-column-width) ?\s)))
|
||||
(insert (propertize cherry 'font-lock-face
|
||||
(if (string= cherry "-")
|
||||
'magit-cherry-equivalent
|
||||
'magit-cherry-unmatched)))
|
||||
(insert ?\s))
|
||||
(when side
|
||||
(insert (propertize side 'font-lock-face
|
||||
(if (string= side "<")
|
||||
'magit-cherry-equivalent
|
||||
'magit-cherry-unmatched)))
|
||||
(insert ?\s))
|
||||
(when align
|
||||
(insert hash ?\s))
|
||||
(when graph
|
||||
(insert graph))
|
||||
(unless align
|
||||
(insert hash ?\s))
|
||||
(unless magit-log-show-refname-after-summary
|
||||
(when refs
|
||||
(insert refs ?\s))
|
||||
(when trailers
|
||||
(insert trailers ?\s)))
|
||||
(when (eq style 'reflog)
|
||||
(insert (format "%-2s " (1- magit-log-count)))
|
||||
(when refsub
|
||||
(insert (magit-reflog-format-subject
|
||||
(substring refsub 0
|
||||
(if (string-search ":" refsub) -2 -1))))))
|
||||
(insert (magit-log--wash-summary msg))
|
||||
(when magit-log-show-refname-after-summary
|
||||
(when refs
|
||||
(insert ?\s refs))
|
||||
(when trailers
|
||||
(insert ?\s trailers)))
|
||||
(insert ?\n)
|
||||
(when (memq style '(log reflog stash))
|
||||
(goto-char (line-beginning-position))
|
||||
(when (and refsub
|
||||
(string-match "\\`\\([^ ]\\) \\+\\(..\\)\\(..\\)" date))
|
||||
(setq date (+ (string-to-number (match-str 1 date))
|
||||
(* (string-to-number (match-str 2 date)) 60 60)
|
||||
(* (string-to-number (match-str 3 date)) 60))))
|
||||
(magit-log-format-margin hash author date))
|
||||
(when (and (eq style 'cherry)
|
||||
(magit--right-margin-active))
|
||||
(apply #'magit-log-format-margin hash
|
||||
(split-string (magit-rev-format "%aN%x00%ct" hash) "\0")))
|
||||
(when (and graph
|
||||
(not (eobp))
|
||||
(not (looking-at non-graph-re)))
|
||||
(when (looking-at "")
|
||||
(magit-insert-heading)
|
||||
(delete-char 1)
|
||||
(magit-insert-section (commit-header)
|
||||
(forward-line)
|
||||
(magit-insert-heading)
|
||||
(delete-char 1)
|
||||
(magit-insert-section (commit-header)
|
||||
(forward-line)
|
||||
(magit-insert-heading)
|
||||
(re-search-forward "")
|
||||
(delete-char -1)
|
||||
(forward-char)
|
||||
(insert ?\n))
|
||||
(delete-char 1))
|
||||
(if (looking-at "^\\(---\\|\n\s\\|\ndiff\\)")
|
||||
(let ((limit (save-excursion
|
||||
(and (re-search-forward non-graph-re nil t)
|
||||
(match-beginning 0)))))
|
||||
(unless (oref magit-insert-section--current content)
|
||||
(magit-insert-heading))
|
||||
(delete-char (if (looking-at "\n") 1 4))
|
||||
(magit-diff-wash-diffs (list "--stat") limit))
|
||||
(re-search-forward "")
|
||||
(delete-char -1)
|
||||
(forward-char)
|
||||
(insert ?\n))
|
||||
(delete-char 1))
|
||||
(if (looking-at "^\\(---\\|\n\s\\|\ndiff\\)")
|
||||
(let ((limit (save-excursion
|
||||
(and (re-search-forward non-graph-re nil t)
|
||||
(match-beginning 0)))))
|
||||
(unless (oref magit-insert-section--current content)
|
||||
(magit-insert-heading))
|
||||
(delete-char (if (looking-at "\n") 1 4))
|
||||
(magit-diff-wash-diffs (list "--stat") limit))
|
||||
(when align
|
||||
(setq align (make-string (1+ abbrev) ? )))
|
||||
(when (and (not (eobp)) (not (looking-at non-graph-re)))
|
||||
(when align
|
||||
(setq align (make-string (1+ abbrev) ? )))
|
||||
(when (and (not (eobp)) (not (looking-at non-graph-re)))
|
||||
(while (and (not (eobp)) (not (looking-at non-graph-re)))
|
||||
(when align
|
||||
(setq align (make-string (1+ abbrev) ? )))
|
||||
(while (and (not (eobp)) (not (looking-at non-graph-re)))
|
||||
(when align
|
||||
(save-excursion (insert align)))
|
||||
(forward-line)
|
||||
(magit-make-margin-overlay))
|
||||
;; When `--format' is used and its value isn't one of the
|
||||
;; predefined formats, then `git-log' does not insert a
|
||||
;; separator line.
|
||||
(save-excursion
|
||||
(forward-line -1)
|
||||
(looking-at "[-_/|\\*o<>. ]*"))
|
||||
(setq graph (match-string 0))
|
||||
(unless (string-match-p "[/\\.]" graph)
|
||||
(insert graph ?\n))))))))
|
||||
(save-excursion (insert align)))
|
||||
(forward-line)
|
||||
(magit-make-margin-overlay))
|
||||
;; When `--format' is used and its value isn't one of the
|
||||
;; predefined formats, then `git-log' does not insert a
|
||||
;; separator line.
|
||||
(save-excursion
|
||||
(forward-line -1)
|
||||
(looking-at "[-_/|\\*o<>. ]*"))
|
||||
(setq graph (match-string 0))
|
||||
(unless (string-match-p "[/\\.]" graph)
|
||||
(insert graph ?\n)))))))
|
||||
t)
|
||||
|
||||
(defun magit-log--wash-summary (summary)
|
||||
@@ -1582,9 +1641,9 @@ See also info node `(magit)Section Movement'."
|
||||
(with-selected-window (get-buffer-window buf)
|
||||
(with-current-buffer buf
|
||||
(save-excursion
|
||||
(magit-blob-visit (list (magit-rev-parse rev)
|
||||
(magit-file-relative-name
|
||||
magit-buffer-file-name)))))))))))))
|
||||
(magit-blob-visit (magit-rev-parse rev)
|
||||
(magit-file-relative-name
|
||||
magit-buffer-file-name))))))))))))
|
||||
|
||||
(defun magit-log-goto-commit-section (rev)
|
||||
(let ((abbrev (magit-rev-format "%h" rev)))
|
||||
@@ -1611,18 +1670,18 @@ The shortstat style is experimental and rather slow."
|
||||
(interactive)
|
||||
(setq magit-log-margin-show-shortstat
|
||||
(not magit-log-margin-show-shortstat))
|
||||
(magit-set-buffer-margin nil t))
|
||||
(magit-set-buffer-margins nil t))
|
||||
|
||||
(defun magit-log-format-margin (rev author date)
|
||||
(when (magit-margin-option)
|
||||
(when (magit--right-margin-option)
|
||||
(if magit-log-margin-show-shortstat
|
||||
(magit-log-format-shortstat-margin rev)
|
||||
(magit-log-format-author-margin author date))))
|
||||
|
||||
(defun magit-log-format-author-margin (author date)
|
||||
(pcase-let ((`(,_ ,style ,width ,details ,details-width)
|
||||
(or magit-buffer-margin
|
||||
(symbol-value (magit-margin-option))
|
||||
(or magit--right-margin-config
|
||||
(symbol-value (magit--right-margin-option))
|
||||
(error "No margin format specified for %s" major-mode))))
|
||||
(magit-make-margin-overlay
|
||||
(concat (and details
|
||||
@@ -1745,15 +1804,14 @@ Type \\[magit-log-select-quit] to abort without selecting a commit."
|
||||
(magit-log-select-setup-buffer
|
||||
(or branch (magit-get-current-branch) "HEAD")
|
||||
(append args
|
||||
(car (magit-log--get-value 'magit-log-select-mode
|
||||
magit-direct-use-buffer-arguments))))
|
||||
(car (magit-log--get-value 'magit-log-select-mode 'direct))))
|
||||
(if initial
|
||||
(magit-log-goto-commit-section initial)
|
||||
(while-let ((rev (magit-section-value-if 'commit))
|
||||
((string-match-p "\\`\\(squash!\\|fixup!\\|amend!\\)"
|
||||
(magit-rev-format "%s" rev)))
|
||||
(section (magit-current-section))
|
||||
(next (car (magit-section-siblings section 'next))))
|
||||
(while-let* ((rev (magit-section-value-if 'commit))
|
||||
(_(string-match-p "\\`\\(squash!\\|fixup!\\|amend!\\)"
|
||||
(magit-rev-format "%s" rev)))
|
||||
(section (magit-current-section))
|
||||
(next (car (magit-section-siblings section 'next))))
|
||||
(magit-section-goto next)))
|
||||
(setq magit-log-select-pick-function pick)
|
||||
(setq magit-log-select-quit-function quit)
|
||||
@@ -1911,7 +1969,7 @@ need an unique value, so we use that string in the pushremote case."
|
||||
"Insert commits that haven't been pulled from the push-remote yet."
|
||||
(when-let* ((target (magit-get-push-branch))
|
||||
(range (concat ".." target))
|
||||
((magit--insert-pushremote-log-p)))
|
||||
(_(magit--insert-pushremote-log-p)))
|
||||
(magit-insert-section (unpulled range t)
|
||||
(magit-insert-heading
|
||||
(format (propertize "Unpulled from %s."
|
||||
@@ -1991,7 +2049,7 @@ Show the last `magit-log-section-commit-count' commits."
|
||||
"Insert commits that haven't been pushed to the push-remote yet."
|
||||
(when-let* ((target (magit-get-push-branch))
|
||||
(range (concat target ".."))
|
||||
((magit--insert-pushremote-log-p)))
|
||||
(_(magit--insert-pushremote-log-p)))
|
||||
(magit-insert-section (unpushed range t)
|
||||
(magit-insert-heading
|
||||
(format (propertize "Unpushed to %s."
|
||||
@@ -2050,4 +2108,15 @@ all others with \"-\"."
|
||||
|
||||
;;; _
|
||||
(provide 'magit-log)
|
||||
;; Local Variables:
|
||||
;; read-symbol-shorthands: (
|
||||
;; ("and$" . "cond-let--and$")
|
||||
;; ("and>" . "cond-let--and>")
|
||||
;; ("and-let" . "cond-let--and-let")
|
||||
;; ("if-let" . "cond-let--if-let")
|
||||
;; ("when-let" . "cond-let--when-let")
|
||||
;; ("while-let" . "cond-let--while-let")
|
||||
;; ("match-string" . "match-string")
|
||||
;; ("match-str" . "match-string-no-properties"))
|
||||
;; End:
|
||||
;;; magit-log.el ends here
|
||||
|
||||
Reference in New Issue
Block a user