update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-log.el --- inspect Git history -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2010-2021 The Magit Project Contributors
|
||||
;; Copyright (C) 2010-2022 The Magit Project Contributors
|
||||
;;
|
||||
;; You should have received a copy of the AUTHORS.md file which
|
||||
;; lists all contributors. If not, see http://magit.vc/authors.
|
||||
@@ -8,6 +8,8 @@
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
;; Magit 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, or (at your option)
|
||||
@@ -32,7 +34,7 @@
|
||||
(require 'magit-core)
|
||||
(require 'magit-diff)
|
||||
|
||||
(declare-function magit-blob-visit "magit-files" (blob-or-file line))
|
||||
(declare-function magit-blob-visit "magit-files" (blob-or-file))
|
||||
(declare-function magit-insert-head-branch-header "magit-status"
|
||||
(&optional branch))
|
||||
(declare-function magit-insert-upstream-branch-header "magit-status"
|
||||
@@ -53,9 +55,6 @@
|
||||
(require 'crm)
|
||||
(require 'which-func)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'subr-x))
|
||||
|
||||
;;; Options
|
||||
;;;; Log Mode
|
||||
|
||||
@@ -78,11 +77,11 @@
|
||||
:options '("--follow" "--grep" "-G" "-S" "-L"))
|
||||
|
||||
(defcustom magit-log-revision-headers-format "\
|
||||
%+b
|
||||
%+b%+N
|
||||
Author: %aN <%aE>
|
||||
Committer: %cN <%cE>"
|
||||
"Additional format string used with the `++header' argument."
|
||||
:package-version '(magit . "2.3.0")
|
||||
:package-version '(magit . "3.2.0")
|
||||
:group 'magit-log
|
||||
:type 'string)
|
||||
|
||||
@@ -407,10 +406,11 @@ the upstream isn't ahead of the current branch) show."
|
||||
["Commit limiting"
|
||||
(magit-log:-n)
|
||||
(magit:--author)
|
||||
(7 "=s" "Limit to commits since" "--since=" transient-read-date)
|
||||
(7 "=u" "Limit to commits until" "--until=" transient-read-date)
|
||||
(7 magit-log:--since)
|
||||
(7 magit-log:--until)
|
||||
(magit-log:--grep)
|
||||
(7 "-I" "Invert search pattern" "--invert-grep")
|
||||
(7 "-i" "Search case-insensitive" ("-i" "--regexp-ignore-case"))
|
||||
(7 "-I" "Invert search pattern" "--invert-grep")
|
||||
(magit-log:-G) ;2
|
||||
(magit-log:-S) ;2
|
||||
(magit-log:-L) ;2
|
||||
@@ -471,7 +471,8 @@ the upstream isn't ahead of the current branch) show."
|
||||
(magit-log:-n)
|
||||
(magit:--author)
|
||||
(magit-log:--grep)
|
||||
(7 "-I" "Invert search pattern" "--invert-grep")
|
||||
(7 "-i" "Search case-insensitive" ("-i" "--regexp-ignore-case"))
|
||||
(7 "-I" "Invert search pattern" "--invert-grep")
|
||||
(magit-log:-G)
|
||||
(magit-log:-S)
|
||||
(magit-log:-L)]
|
||||
@@ -549,6 +550,20 @@ the upstream isn't ahead of the current branch) show."
|
||||
:argument "--author="
|
||||
:reader 'magit-transient-read-person)
|
||||
|
||||
(transient-define-argument magit-log:--since ()
|
||||
:description "Limit to commits since"
|
||||
:class 'transient-option
|
||||
:key "=s"
|
||||
:argument "--since="
|
||||
:reader 'transient-read-date)
|
||||
|
||||
(transient-define-argument magit-log:--until ()
|
||||
:description "Limit to commits until"
|
||||
:class 'transient-option
|
||||
:key "=u"
|
||||
:argument "--until="
|
||||
:reader 'transient-read-date)
|
||||
|
||||
(transient-define-argument magit-log:--*-order ()
|
||||
:description "Order commits by"
|
||||
:class 'transient-switches
|
||||
@@ -594,16 +609,17 @@ the upstream isn't ahead of the current branch) show."
|
||||
|
||||
(defun magit-log-read-revs (&optional use-current)
|
||||
(or (and use-current (--when-let (magit-get-current-branch) (list it)))
|
||||
(let ((collection (magit-list-refnames nil t)))
|
||||
(split-string
|
||||
(magit-completing-read-multiple "Log rev,s" collection
|
||||
"\\(\\.\\.\\.?\\|[, ]\\)"
|
||||
(or (magit-branch-or-commit-at-point)
|
||||
(unless use-current
|
||||
(magit-get-previous-branch)))
|
||||
'magit-revision-history
|
||||
magit-log-read-revs-map)
|
||||
"[, ]" t))))
|
||||
(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
|
||||
(or (magit-branch-or-commit-at-point)
|
||||
(unless use-current
|
||||
(magit-get-previous-branch)))
|
||||
nil t)
|
||||
"[, ]" t))))
|
||||
|
||||
(defun magit-log-read-pattern (option)
|
||||
"Read a string from the user to pass as parameter to OPTION."
|
||||
@@ -768,7 +784,7 @@ commits instead.
|
||||
This command requires git-when-merged, which is available from
|
||||
https://github.com/mhagger/git-when-merged."
|
||||
(interactive
|
||||
(append (let ((commit (magit-read-branch-or-commit "Commit")))
|
||||
(append (let ((commit (magit-read-branch-or-commit "Log merge of commit")))
|
||||
(list commit
|
||||
(magit-read-other-branch "Merged into" commit)))
|
||||
(magit-log-arguments)))
|
||||
@@ -778,11 +794,9 @@ https://github.com/mhagger/git-when-merged."
|
||||
(let (exit m)
|
||||
(with-temp-buffer
|
||||
(save-excursion
|
||||
(setq exit (magit-process-file
|
||||
magit-git-executable nil t nil
|
||||
"when-merged" "-c"
|
||||
"--abbrev" (number-to-string (magit-abbrev-length))
|
||||
commit branch)))
|
||||
(setq exit (magit-process-git t "when-merged" "-c"
|
||||
(magit-abbrev-arg)
|
||||
commit branch)))
|
||||
(setq m (buffer-substring-no-properties (point) (line-end-position))))
|
||||
(if (zerop exit)
|
||||
(magit-log-setup-buffer (list (format "%s^1..%s" m m))
|
||||
@@ -876,6 +890,26 @@ is displayed in the current frame."
|
||||
"\\[magit-log-double-commit-limit] first"))))
|
||||
(user-error "Parent %s does not exist" parent-rev))))))
|
||||
|
||||
(defun magit-log-move-to-revision (rev)
|
||||
"Read a revision and move to it in current log buffer.
|
||||
|
||||
If the chosen reference or revision isn't being displayed in
|
||||
the current log buffer, then inform the user about that and do
|
||||
nothing else.
|
||||
|
||||
If invoked outside any log buffer, then display the log buffer
|
||||
of the current repository first; creating it if necessary."
|
||||
(interactive (list (magit-read-branch-or-commit "In log, jump to")))
|
||||
(with-current-buffer
|
||||
(cond ((derived-mode-p 'magit-log-mode)
|
||||
(current-buffer))
|
||||
((when-let ((buf (magit-get-mode-buffer 'magit-log-mode)))
|
||||
(pop-to-buffer-same-window buf)))
|
||||
(t
|
||||
(apply #'magit-log-all-branches (magit-log-arguments))))
|
||||
(unless (magit-log-goto-commit-section (magit-rev-abbrev rev))
|
||||
(user-error "%s isn't visible in the current log buffer" rev))))
|
||||
|
||||
;;;; Shortlog Commands
|
||||
|
||||
;;;###autoload (autoload 'magit-shortlog "magit-log" nil t)
|
||||
@@ -896,11 +930,15 @@ is displayed in the current frame."
|
||||
("r" "range" magit-shortlog-range)])
|
||||
|
||||
(defun magit-git-shortlog (rev args)
|
||||
(with-current-buffer (get-buffer-create "*magit-shortlog*")
|
||||
(erase-buffer)
|
||||
(save-excursion
|
||||
(magit-git-insert "shortlog" args rev))
|
||||
(switch-to-buffer-other-window (current-buffer))))
|
||||
(let ((dir default-directory))
|
||||
(with-current-buffer (get-buffer-create "*magit-shortlog*")
|
||||
(setq default-directory dir)
|
||||
(setq buffer-read-only t)
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(save-excursion
|
||||
(magit-git-insert "shortlog" args rev))
|
||||
(switch-to-buffer-other-window (current-buffer))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-shortlog-since (rev args)
|
||||
@@ -927,9 +965,10 @@ is displayed in the current frame."
|
||||
(defvar magit-log-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-mode-map)
|
||||
(define-key map "\C-c\C-b" 'magit-go-backward)
|
||||
(define-key map "\C-c\C-f" 'magit-go-forward)
|
||||
(define-key map "\C-c\C-n" 'magit-log-move-to-parent)
|
||||
(define-key map (kbd "C-c C-b") 'magit-go-backward)
|
||||
(define-key map (kbd "C-c C-f") 'magit-go-forward)
|
||||
(define-key map (kbd "C-c C-n") 'magit-log-move-to-parent)
|
||||
(define-key map "j" 'magit-log-move-to-revision)
|
||||
(define-key map "=" 'magit-log-toggle-commit-limit)
|
||||
(define-key map "+" 'magit-log-double-commit-limit)
|
||||
(define-key map "-" 'magit-log-half-commit-limit)
|
||||
@@ -982,9 +1021,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(files magit-buffer-log-files))
|
||||
(magit-set-header-line-format
|
||||
(funcall magit-log-header-line-function revs args files))
|
||||
(if (= (length files) 1)
|
||||
(unless (magit-file-tracked-p (car files))
|
||||
(setq args (cons "--full-history" args)))
|
||||
(unless (= (length files) 1)
|
||||
(setq args (remove "--follow" args)))
|
||||
(when (and (car magit-log-remove-graph-args)
|
||||
(--any-p (string-match-p
|
||||
@@ -1069,6 +1106,7 @@ Do not add this to a hook variable."
|
||||
(setq args (cons "--decorate=full" (remove "--decorate" args))))
|
||||
(when (member "--reverse" args)
|
||||
(setq args (remove "--graph" args)))
|
||||
(setq args (magit-diff--maybe-add-stat-arguments args))
|
||||
args)
|
||||
"--use-mailmap" "--no-prefix" revs "--" files)))
|
||||
|
||||
@@ -1211,6 +1249,17 @@ Do not add this to a hook variable."
|
||||
(`stash (oset section type 'stash))
|
||||
(`module (oset section type 'module-commit))
|
||||
(`bisect-log (setq hash (magit-rev-parse "--short" hash))))
|
||||
(setq hash (propertize 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)
|
||||
@@ -1227,11 +1276,11 @@ Do not add this to a hook variable."
|
||||
'magit-cherry-unmatched)))
|
||||
(insert ?\s))
|
||||
(when align
|
||||
(insert (propertize hash 'font-lock-face 'magit-hash) ?\s))
|
||||
(insert hash ?\s))
|
||||
(when graph
|
||||
(insert graph))
|
||||
(unless align
|
||||
(insert (propertize hash 'font-lock-face 'magit-hash) ?\s))
|
||||
(insert hash ?\s))
|
||||
(when (and refs (not magit-log-show-refname-after-summary))
|
||||
(insert (magit-format-ref-labels refs) ?\s))
|
||||
(when (eq style 'reflog)
|
||||
@@ -1240,16 +1289,6 @@ Do not add this to a hook variable."
|
||||
(insert (magit-reflog-format-subject
|
||||
(substring refsub 0 (if (string-match-p ":" refsub) -2 -1))))))
|
||||
(when msg
|
||||
(when gpg
|
||||
(setq msg (propertize msg 'font-lock-face
|
||||
(pcase (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)))))
|
||||
(insert (funcall magit-log-format-message-function hash msg)))
|
||||
(when (and refs magit-log-show-refname-after-summary)
|
||||
(insert ?\s)
|
||||
@@ -1363,9 +1402,8 @@ If there is no revision buffer in the same frame, then do nothing."
|
||||
(setq magit--update-revision-buffer (list commit buffer))
|
||||
(run-with-idle-timer
|
||||
magit-update-other-window-delay nil
|
||||
(let ((args (with-current-buffer buffer
|
||||
(let ((magit-direct-use-buffer-arguments 'selected))
|
||||
(magit-show-commit--arguments)))))
|
||||
(let ((args (let ((magit-direct-use-buffer-arguments 'selected))
|
||||
(magit-show-commit--arguments))))
|
||||
(lambda ()
|
||||
(pcase-let ((`(,rev ,buf) magit--update-revision-buffer))
|
||||
(setq magit--update-revision-buffer nil)
|
||||
@@ -1402,8 +1440,7 @@ If there is no blob buffer in the same frame, then do nothing."
|
||||
(save-excursion
|
||||
(magit-blob-visit (list (magit-rev-parse rev)
|
||||
(magit-file-relative-name
|
||||
magit-buffer-file-name))
|
||||
(line-number-at-pos))))))))))))
|
||||
magit-buffer-file-name)))))))))))))
|
||||
|
||||
(defun magit-log-goto-commit-section (rev)
|
||||
(let ((abbrev (magit-rev-format "%h" rev)))
|
||||
@@ -1445,7 +1482,8 @@ The shortstat style is experimental and rather slow."
|
||||
(truncate-string-to-width
|
||||
(or author "")
|
||||
details-width
|
||||
nil ?\s (make-string 1 magit-ellipsis))
|
||||
nil ?\s
|
||||
(if (char-displayable-p ?…) "…" ">"))
|
||||
'magit-log-author)
|
||||
" "))
|
||||
(magit--propertize-face
|
||||
@@ -1504,13 +1542,13 @@ The shortstat style is experimental and rather slow."
|
||||
(defvar magit-log-select-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-log-mode-map)
|
||||
(define-key map "\C-c\C-b" 'undefined)
|
||||
(define-key map "\C-c\C-f" 'undefined)
|
||||
(define-key map "." 'magit-log-select-pick)
|
||||
(define-key map "e" 'magit-log-select-pick)
|
||||
(define-key map "\C-c\C-c" 'magit-log-select-pick)
|
||||
(define-key map "q" 'magit-log-select-quit)
|
||||
(define-key map "\C-c\C-k" 'magit-log-select-quit)
|
||||
(define-key map (kbd "C-c C-b") 'undefined)
|
||||
(define-key map (kbd "C-c C-f") 'undefined)
|
||||
(define-key map (kbd ".") 'magit-log-select-pick)
|
||||
(define-key map (kbd "e") 'magit-log-select-pick)
|
||||
(define-key map (kbd "C-c C-c") 'magit-log-select-pick)
|
||||
(define-key map (kbd "q") 'magit-log-select-quit)
|
||||
(define-key map (kbd "C-c C-k") 'magit-log-select-quit)
|
||||
map)
|
||||
"Keymap for `magit-log-select-mode'.")
|
||||
|
||||
@@ -1600,11 +1638,12 @@ commit as argument."
|
||||
(funcall fun rev)))
|
||||
|
||||
(defun magit-log-select-quit ()
|
||||
"Abort selecting a commit, don't act on any commit."
|
||||
"Abort selecting a commit, don't act on any commit.
|
||||
Call `magit-log-select-quit-function' if set."
|
||||
(interactive)
|
||||
(magit-mode-bury-buffer 'kill)
|
||||
(when magit-log-select-quit-function
|
||||
(funcall magit-log-select-quit-function)))
|
||||
(let ((fun magit-log-select-quit-function))
|
||||
(magit-mode-bury-buffer 'kill)
|
||||
(when fun (funcall fun))))
|
||||
|
||||
;;; Cherry Mode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user