update of packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-log.el --- Inspect Git history -*- lexical-binding:t; coding:utf-8 -*-
|
||||
|
||||
;; Copyright (C) 2008-2022 The Magit Project Contributors
|
||||
;; Copyright (C) 2008-2023 The Magit Project Contributors
|
||||
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
|
||||
@@ -70,7 +70,14 @@
|
||||
:type 'hook)
|
||||
|
||||
(defcustom magit-log-remove-graph-args '("--follow" "--grep" "-G" "-S" "-L")
|
||||
"The log arguments that cause the `--graph' argument to be dropped."
|
||||
"The log arguments that cause the `--graph' argument to be dropped.
|
||||
|
||||
The default value lists the arguments that are incompatible with
|
||||
`--graph' and therefore must be dropped when that is used. You
|
||||
can add additional arguments that are available in `magit-log',
|
||||
but I recommend that you don't do that. Nowadays I would define
|
||||
this as a constant, but I am preserving it as an option, in case
|
||||
someone actually customized it."
|
||||
:package-version '(magit . "2.3.0")
|
||||
:group 'magit-log
|
||||
:type '(repeat (string :tag "Argument"))
|
||||
@@ -162,6 +169,26 @@ because the latter may make use of Imenu's outdated cache."
|
||||
(function-item add-log-current-defun)
|
||||
function))
|
||||
|
||||
(defcustom magit-log-color-graph-limit 256
|
||||
"Number of commits over which log graphs are not colored.
|
||||
When showing more commits than specified, then the `--color'
|
||||
argument is silently dropped. This is necessary because the
|
||||
`ansi-color' library, which is used to turn control sequences
|
||||
into faces, is just too slow."
|
||||
:package-version '(magit . "4.0.0")
|
||||
:group 'magit-log
|
||||
:type 'number)
|
||||
|
||||
(defcustom magit-log-show-signatures-limit 256
|
||||
"Number of commits over which signatures are not verified.
|
||||
When showing more commits than specified by this option, then the
|
||||
`--show-signature' argument, if specified, is silently dropped.
|
||||
This is necessary because checking the signature of a large
|
||||
number of commits is just too slow."
|
||||
:package-version '(magit . "4.0.0")
|
||||
:group 'magit-log
|
||||
:type 'number)
|
||||
|
||||
(defface magit-log-graph
|
||||
'((((class color) (background light)) :foreground "grey30")
|
||||
(((class color) (background dark)) :foreground "grey80"))
|
||||
@@ -348,9 +375,7 @@ 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))
|
||||
(pcase-let ((`(,args ,alist)
|
||||
(-separate #'atom (transient-get-value))))
|
||||
(list args (cdr (assoc "--" alist))))
|
||||
(magit--transient-args-and-files)
|
||||
(magit-log--get-value (or mode 'magit-log-mode))))
|
||||
|
||||
(defun magit-log--get-value (mode &optional use-buffer-args)
|
||||
@@ -383,9 +408,7 @@ commits before and half after."
|
||||
(pcase-let* ((obj (oref obj prototype))
|
||||
(mode (or (oref obj major-mode) major-mode))
|
||||
(key (intern (format "magit-log:%s" mode)))
|
||||
(`(,args ,alist)
|
||||
(-separate #'atom (transient-get-value)))
|
||||
(files (cdr (assoc "--" alist))))
|
||||
(`(,args ,files) (magit--transient-args-and-files)))
|
||||
(put mode 'magit-log-current-arguments args)
|
||||
(when save
|
||||
(setf (alist-get key transient-values) args)
|
||||
@@ -514,13 +537,13 @@ commits before and half after."
|
||||
("-d" "Show refnames" "--decorate")]
|
||||
[["Refresh"
|
||||
("g" "buffer" magit-log-refresh)
|
||||
("s" "buffer and set defaults" transient-set :transient nil)
|
||||
("w" "buffer and save defaults" transient-save :transient nil)]
|
||||
("s" "buffer and set defaults" transient-set-and-exit)
|
||||
("w" "buffer and save defaults" transient-save-and-exit)]
|
||||
["Margin"
|
||||
("L" "toggle visibility" magit-toggle-margin :transient t)
|
||||
("l" "cycle style" magit-cycle-margin-style :transient t)
|
||||
("d" "toggle details" magit-toggle-margin-details)
|
||||
("x" "toggle shortstat" magit-toggle-log-margin-style)]
|
||||
("L" "toggle visibility" magit-toggle-margin :transient t)
|
||||
("l" "cycle style" magit-cycle-margin-style :transient t)
|
||||
("d" "toggle details" magit-toggle-margin-details :transient t)
|
||||
("x" "toggle shortstat" magit-toggle-log-margin-style :transient t)]
|
||||
[:if-mode magit-log-mode
|
||||
:description "Toggle"
|
||||
("b" "buffer lock" magit-toggle-buffer-lock)]]
|
||||
@@ -610,23 +633,21 @@ commits before and half after."
|
||||
|
||||
;;;; Setup Commands
|
||||
|
||||
(defvar magit-log-read-revs-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map crm-local-completion-map)
|
||||
(define-key map "\s" #'self-insert-command)
|
||||
map))
|
||||
(defvar-keymap magit-log-read-revs-map
|
||||
:parent crm-local-completion-map
|
||||
"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)))
|
||||
(let ((crm-separator "\\(\\.\\.\\.?\\|[, ]\\)")
|
||||
(crm-local-completion-map magit-log-read-revs-map))
|
||||
(split-string (magit-completing-read-multiple*
|
||||
(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)))
|
||||
(and (not use-current)
|
||||
(magit-get-previous-branch)))
|
||||
nil t)
|
||||
"[, ]" t))))
|
||||
|
||||
@@ -845,7 +866,7 @@ https://github.com/mhagger/git-when-merged."
|
||||
(if (equal m "Commit is directly on this branch.")
|
||||
(let* ((from (format "%s~%d" commit
|
||||
(/ magit-log-merged-commit-count 2)))
|
||||
(to (- (car (magit-rev-diff-count branch commit))
|
||||
(to (- (car (magit-rev-diff-count branch commit t))
|
||||
(/ magit-log-merged-commit-count 2)))
|
||||
(to (if (<= to 0)
|
||||
branch
|
||||
@@ -883,16 +904,16 @@ limit. Otherwise set it to 256."
|
||||
(arg (--first (string-match "^-n\\([0-9]+\\)?$" it) val))
|
||||
(num (and arg (string-to-number (match-string 1 arg))))
|
||||
(num (if num (funcall fn num 2) 256)))
|
||||
(setq val (delete arg val))
|
||||
(setq val (remove arg val))
|
||||
(setq magit-buffer-log-args
|
||||
(if (and num (> num 0))
|
||||
(cons (format "-n%i" num) val)
|
||||
(cons (format "-n%d" num) val)
|
||||
val)))
|
||||
(magit-refresh))
|
||||
|
||||
(defun magit-log-get-commit-limit ()
|
||||
(defun magit-log-get-commit-limit (&optional args)
|
||||
(and-let* ((str (--first (string-match "^-n\\([0-9]+\\)?$" it)
|
||||
magit-buffer-log-args)))
|
||||
(or args magit-buffer-log-args))))
|
||||
(string-to-number (match-string 1 str))))
|
||||
|
||||
;;;; Mode Commands
|
||||
@@ -1004,19 +1025,17 @@ of the current repository first; creating it if necessary."
|
||||
'("-G" "--grep" "--author")
|
||||
"Arguments which disable the graph speedup hack.")
|
||||
|
||||
(defvar magit-log-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-mode-map)
|
||||
(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)
|
||||
(define-key map "q" #'magit-log-bury-buffer)
|
||||
map)
|
||||
"Keymap for `magit-log-mode'.")
|
||||
(defvar-keymap magit-log-mode-map
|
||||
:doc "Keymap for `magit-log-mode'."
|
||||
:parent magit-mode-map
|
||||
"C-c C-b" #'magit-go-backward
|
||||
"C-c C-f" #'magit-go-forward
|
||||
"C-c C-n" #'magit-log-move-to-parent
|
||||
"j" #'magit-log-move-to-revision
|
||||
"=" #'magit-log-toggle-commit-limit
|
||||
"+" #'magit-log-double-commit-limit
|
||||
"-" #'magit-log-half-commit-limit
|
||||
"q" #'magit-log-bury-buffer)
|
||||
|
||||
(define-derived-mode magit-log-mode magit-mode "Magit Log"
|
||||
"Mode for looking at Git log.
|
||||
@@ -1057,7 +1076,8 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(defun magit-log-refresh-buffer ()
|
||||
(let ((revs magit-buffer-revisions)
|
||||
(args magit-buffer-log-args)
|
||||
(files magit-buffer-log-files))
|
||||
(files magit-buffer-log-files)
|
||||
(limit (magit-log-get-commit-limit)))
|
||||
(magit-set-header-line-format
|
||||
(funcall magit-log-header-line-function revs args files))
|
||||
(unless (length= files 1)
|
||||
@@ -1067,27 +1087,49 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(concat "^" (regexp-opt magit-log-remove-graph-args)) it)
|
||||
args))
|
||||
(setq args (remove "--graph" args)))
|
||||
(unless (member "--graph" args)
|
||||
(setq args (remove "--color" args)))
|
||||
(when-let* ((limit (magit-log-get-commit-limit))
|
||||
(setq args (magit-log--maybe-drop-color-graph args limit))
|
||||
(when-let* ((limit limit)
|
||||
(limit (* 2 limit)) ; increase odds for complete graph
|
||||
(count (and (length= revs 1)
|
||||
(> limit 1024) ; otherwise it's fast enough
|
||||
(setq revs (car revs))
|
||||
(not (string-search ".." revs))
|
||||
(not (member revs '("--all" "--branches")))
|
||||
(-none-p (lambda (arg)
|
||||
(--any-p
|
||||
(string-prefix-p it arg)
|
||||
magit-log-disable-graph-hack-args))
|
||||
args)
|
||||
(not (seq-some
|
||||
(lambda (arg)
|
||||
(--any-p (string-prefix-p it arg)
|
||||
magit-log-disable-graph-hack-args))
|
||||
args))
|
||||
(magit-git-string "rev-list" "--count"
|
||||
"--first-parent" args revs))))
|
||||
(setq revs (if (< (string-to-number count) limit)
|
||||
revs
|
||||
(format "%s~%s..%s" revs limit revs))))
|
||||
(let ((delay (cl-find-if (lambda (arg)
|
||||
(member arg '("++header" "--patch" "--stat")))
|
||||
args)))
|
||||
(setq magit-section-inhibit-markers (if delay 'delay t))
|
||||
(setq magit-section-insert-in-reverse (not delay)))
|
||||
(magit-insert-section (logbuf)
|
||||
(magit-insert-log revs args files))))
|
||||
(magit--insert-log t revs args files))))
|
||||
|
||||
(defvar-local magit-log--color-graph nil)
|
||||
|
||||
(defun magit-log--maybe-drop-color-graph (args limit)
|
||||
(if (member "--color" args)
|
||||
(if (cond ((not (member "--graph" args)))
|
||||
((not magit-log-color-graph-limit) nil)
|
||||
((not limit)
|
||||
(message "Dropping --color because -n isn't set (see %s)"
|
||||
'magit-log-color-graph-limit))
|
||||
((> limit magit-log-color-graph-limit)
|
||||
(message "Dropping --color because -n is larger than %s"
|
||||
'magit-log-color-graph-limit)))
|
||||
(progn (setq args (remove "--color" args))
|
||||
(setq magit-log--color-graph nil))
|
||||
(setq magit-log--color-graph t))
|
||||
(setq magit-log--color-graph nil))
|
||||
args)
|
||||
|
||||
(cl-defmethod magit-buffer-value (&context (major-mode magit-log-mode))
|
||||
(append magit-buffer-revisions
|
||||
@@ -1117,11 +1159,17 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
args)))
|
||||
|
||||
(defun magit-insert-log (revs &optional args files)
|
||||
(declare (obsolete magit--insert-log "Magit 4.0.0"))
|
||||
(magit--insert-log nil revs args files))
|
||||
|
||||
(defun magit--insert-log (keep-error revs &optional args files)
|
||||
"Insert a log section.
|
||||
Do not add this to a hook variable."
|
||||
(declare (indent defun))
|
||||
(setq magit-section-preserve-visibility t) ; TODO do it here?
|
||||
(let ((magit-git-global-arguments
|
||||
(remove "--literal-pathspecs" magit-git-global-arguments)))
|
||||
(magit-git-wash (apply-partially #'magit-log-wash-log 'log)
|
||||
(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"
|
||||
(if (and (member "--left-right" args)
|
||||
@@ -1129,9 +1177,22 @@ Do not add this to a hook variable."
|
||||
"%m "
|
||||
"")
|
||||
(if (member "--decorate" args) "%D" "")
|
||||
(if (member "--show-signature" args)
|
||||
(progn (setq args (remove "--show-signature" args)) "%G?")
|
||||
"")
|
||||
(if (not (member "--show-signature" args))
|
||||
""
|
||||
(setq args (remove "--show-signature" args))
|
||||
(let ((limit (magit-log-get-commit-limit args)))
|
||||
(cond
|
||||
((not limit)
|
||||
(message
|
||||
"Dropping --show-signature because -n isn't set (see %s)"
|
||||
'magit-log-show-signatures-limit)
|
||||
"")
|
||||
((> limit magit-log-show-signatures-limit)
|
||||
(message
|
||||
"Dropping --show-signature because -n is larger than %s"
|
||||
'magit-log-show-signatures-limit)
|
||||
"")
|
||||
("%G?"))))
|
||||
(if magit-log-margin-show-committer-date "%ct" "%at")
|
||||
(if (member "++header" args)
|
||||
(if (member "--graph" (setq args (remove "++header" args)))
|
||||
@@ -1139,9 +1200,10 @@ Do not add this to a hook variable."
|
||||
(concat "\n" magit-log-revision-headers-format "\n"))
|
||||
""))
|
||||
(progn
|
||||
(--when-let (--first (string-match "^\\+\\+order=\\(.+\\)$" it) args)
|
||||
(setq args (cons (format "--%s-order" (match-string 1 it))
|
||||
(remove it args))))
|
||||
(when-let ((order (--first (string-match "^\\+\\+order=\\(.+\\)$" it)
|
||||
args)))
|
||||
(setq args (cons (format "--%s-order" (match-string 1 order))
|
||||
(remove order args))))
|
||||
(when (member "--decorate" args)
|
||||
(setq args (cons "--decorate=full" (remove "--decorate" args))))
|
||||
(when (member "--reverse" args)
|
||||
@@ -1154,26 +1216,18 @@ Do not add this to a hook variable."
|
||||
(or (magit-diff--region-range)
|
||||
(oref (magit-current-section) value)))
|
||||
|
||||
(defvar magit-commit-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
;; The second remapping overrides the first but we still get two menu
|
||||
;; items, though only one of them will be available at any given time.
|
||||
(magit-menu-set map [magit-visit-thing]
|
||||
#'magit-diff-range "Diff %x"
|
||||
'(:visible (region-active-p)))
|
||||
(magit-menu-set map [magit-visit-thing]
|
||||
#'magit-show-commit "Show commit %x"
|
||||
'(:visible (not (region-active-p))))
|
||||
(magit-menu-set map [magit-cherry-apply]
|
||||
#'magit-cherry-apply "Apply %x")
|
||||
map)
|
||||
"Keymap for `commit' sections.")
|
||||
(defvar-keymap magit-commit-section-map
|
||||
:doc "Keymap for `commit' sections."
|
||||
"<remap> <magit-visit-thing>" #'magit-show-commit
|
||||
"<3>" (magit-menu-item "Apply %x" #'magit-cherry-apply)
|
||||
"<2>" (magit-menu-item "Show commit %x" #'magit-show-commit
|
||||
'(:visible (not (region-active-p))))
|
||||
"<1>" (magit-menu-item "Diff %x" #'magit-diff-range
|
||||
'(:visible (region-active-p))))
|
||||
|
||||
(defvar magit-module-commit-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-commit-section-map)
|
||||
map)
|
||||
"Keymap for `module-commit' sections.")
|
||||
(defvar-keymap magit-module-commit-section-map
|
||||
:doc "Keymap for `module-commit' sections."
|
||||
:parent magit-commit-section-map)
|
||||
|
||||
(defconst magit-log-heading-re
|
||||
;; Note: A form feed instead of a null byte is used as the delimiter
|
||||
@@ -1222,7 +1276,7 @@ Do not add this to a hook variable."
|
||||
"\\(?:\\(?:[^@\n]+@{\\(?6:[^}\n]+\\)}\0" ; date
|
||||
;;; refsub
|
||||
"\\(?10:merge \\|autosave \\|restart \\|rewritten \\|[^:\n]+: \\)?"
|
||||
"\\(?2:.*\\)?\\)\\|\0\\)$")) ; msg
|
||||
"\\(?2:.*\\)\\)\\|\0\\)$")) ; msg
|
||||
|
||||
(defconst magit-reflog-subject-re
|
||||
(concat "\\(?1:[^ ]+\\) ?" ; command
|
||||
@@ -1242,8 +1296,10 @@ Do not add this to a hook variable."
|
||||
|
||||
(defun magit-log-wash-log (style args)
|
||||
(setq args (flatten-tree args))
|
||||
(when (and (member "--graph" args)
|
||||
(member "--color" args))
|
||||
(when (if (derived-mode-p 'magit-log-mode)
|
||||
magit-log--color-graph
|
||||
(and (member "--graph" args)
|
||||
(member "--color" args)))
|
||||
(let ((ansi-color-apply-face-function
|
||||
(lambda (beg end face)
|
||||
(put-text-property beg end 'font-lock-face
|
||||
@@ -1342,8 +1398,7 @@ Do not add this to a hook variable."
|
||||
(insert (magit-reflog-format-subject
|
||||
(substring refsub 0
|
||||
(if (string-search ":" refsub) -2 -1))))))
|
||||
(when msg
|
||||
(insert (funcall magit-log-format-message-function hash msg)))
|
||||
(insert (funcall magit-log-format-message-function hash msg))
|
||||
(when (and refs magit-log-show-refname-after-summary)
|
||||
(insert ?\s)
|
||||
(insert (magit-format-ref-labels refs)))
|
||||
@@ -1374,7 +1429,7 @@ Do not add this to a hook variable."
|
||||
(forward-line)
|
||||
(magit-insert-heading)
|
||||
(re-search-forward "")
|
||||
(backward-delete-char 1)
|
||||
(delete-char -1)
|
||||
(forward-char)
|
||||
(insert ?\n))
|
||||
(delete-char 1))
|
||||
@@ -1414,7 +1469,7 @@ Do not add this to a hook variable."
|
||||
(magit--put-face (match-beginning 0) (1- boundary)
|
||||
'magit-keyword-squash msg))
|
||||
(when magit-log-highlight-keywords
|
||||
(while (string-match "\\[[^[]*?]" msg boundary)
|
||||
(while (string-match "\\[[^][]*]" msg boundary)
|
||||
(setq boundary (match-end 0))
|
||||
(magit--put-face (match-beginning 0) boundary
|
||||
'magit-keyword msg))))
|
||||
@@ -1537,7 +1592,7 @@ The shortstat style is experimental and rather slow."
|
||||
(or author "")
|
||||
details-width
|
||||
nil ?\s
|
||||
(if (char-displayable-p ?…) "…" ">"))
|
||||
(magit--ellipsis 'margin))
|
||||
'magit-log-author)
|
||||
" "))
|
||||
(magit--propertize-face
|
||||
@@ -1547,7 +1602,7 @@ The shortstat style is experimental and rather slow."
|
||||
(seconds-to-time (string-to-number date)))
|
||||
(pcase-let* ((abbr (eq style 'age-abbreviated))
|
||||
(`(,cnt ,unit) (magit--age date abbr)))
|
||||
(format (format (if abbr "%%2i%%-%ic" "%%2i %%-%is")
|
||||
(format (format (if abbr "%%2d%%-%dc" "%%2d %%-%ds")
|
||||
(- width (if details (1+ details-width) 0)))
|
||||
cnt unit)))
|
||||
'magit-log-date))
|
||||
@@ -1593,19 +1648,16 @@ The shortstat style is experimental and rather slow."
|
||||
|
||||
;;; Select Mode
|
||||
|
||||
(defvar magit-log-select-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-log-mode-map)
|
||||
(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'.")
|
||||
|
||||
(defvar-keymap magit-log-select-mode-map
|
||||
:doc "Keymap for `magit-log-select-mode'."
|
||||
:parent magit-log-mode-map
|
||||
"C-c C-b" #'undefined
|
||||
"C-c C-f" #'undefined
|
||||
"." #'magit-log-select-pick
|
||||
"e" #'magit-log-select-pick
|
||||
"C-c C-c" #'magit-log-select-pick
|
||||
"q" #'magit-log-select-quit
|
||||
"C-c C-k" #'magit-log-select-quit)
|
||||
(put 'magit-log-select-pick :advertised-binding [?\C-c ?\C-c])
|
||||
(put 'magit-log-select-quit :advertised-binding [?\C-c ?\C-k])
|
||||
|
||||
@@ -1634,9 +1686,13 @@ Type \\[magit-log-select-quit] to abort without selecting a commit."
|
||||
(magit-buffer-log-args args)))
|
||||
|
||||
(defun magit-log-select-refresh-buffer ()
|
||||
(setq magit-section-inhibit-markers t)
|
||||
(setq magit-section-insert-in-reverse t)
|
||||
(magit-insert-section (logbuf)
|
||||
(magit-insert-log magit-buffer-revisions
|
||||
magit-buffer-log-args)))
|
||||
(magit--insert-log t magit-buffer-revisions
|
||||
(magit-log--maybe-drop-color-graph
|
||||
magit-buffer-log-args
|
||||
(magit-log-get-commit-limit)))))
|
||||
|
||||
(cl-defmethod magit-buffer-value (&context (major-mode magit-log-select-mode))
|
||||
magit-buffer-revisions)
|
||||
@@ -1701,13 +1757,11 @@ Call `magit-log-select-quit-function' if set."
|
||||
|
||||
;;; Cherry Mode
|
||||
|
||||
(defvar magit-cherry-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-mode-map)
|
||||
(define-key map "q" #'magit-log-bury-buffer)
|
||||
(define-key map "L" #'magit-margin-settings)
|
||||
map)
|
||||
"Keymap for `magit-cherry-mode'.")
|
||||
(defvar-keymap magit-cherry-mode-map
|
||||
:doc "Keymap for `magit-cherry-mode'."
|
||||
:parent magit-mode-map
|
||||
"q" #'magit-log-bury-buffer
|
||||
"L" #'magit-margin-settings)
|
||||
|
||||
(define-derived-mode magit-cherry-mode magit-mode "Magit Cherry"
|
||||
"Mode for looking at commits not merged upstream.
|
||||
@@ -1731,6 +1785,8 @@ Type \\[magit-cherry-pick] to apply the commit at point.
|
||||
(magit-buffer-range (concat upstream ".." head))))
|
||||
|
||||
(defun magit-cherry-refresh-buffer ()
|
||||
(setq magit-section-inhibit-markers t)
|
||||
(setq magit-section-insert-in-reverse t)
|
||||
(magit-insert-section (cherry)
|
||||
(magit-run-section-hook 'magit-cherry-sections-hook)))
|
||||
|
||||
@@ -1771,20 +1827,17 @@ Type \\[magit-cherry-pick] to apply the commit at point.
|
||||
;;; Log Sections
|
||||
;;;; Standard Log Sections
|
||||
|
||||
(defvar magit-log-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(magit-menu-set map [magit-visit-thing] #'magit-diff-dwim "Visit diff")
|
||||
map)
|
||||
"Keymap for log sections.
|
||||
(defvar-keymap magit-log-section-map
|
||||
:doc "Keymap for log sections.
|
||||
The classes `magit-{unpulled,unpushed,unmerged}-section' derive
|
||||
from the abstract `magit-log-section' class. Accordingly this
|
||||
keymap is the parent of their keymaps.")
|
||||
keymap is the parent of their keymaps."
|
||||
"<remap> <magit-visit-thing>" #'magit-diff-dwim
|
||||
"<1>" (magit-menu-item "Visit diff" #'magit-diff-dwim))
|
||||
|
||||
(defvar magit-unpulled-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-log-section-map)
|
||||
map)
|
||||
"Keymap for `unpulled' sections.")
|
||||
(defvar-keymap magit-unpulled-section-map
|
||||
:doc "Keymap for `unpulled' sections."
|
||||
:parent magit-log-section-map)
|
||||
|
||||
(cl-defmethod magit-section-ident-value ((section magit-unpulled-section))
|
||||
"\"..@{push}\" cannot be used as the value because that is
|
||||
@@ -1806,30 +1859,28 @@ in the pushremote case."
|
||||
(format (propertize "Unpulled from %s."
|
||||
'font-lock-face 'magit-section-heading)
|
||||
upstream))
|
||||
(magit-insert-log "..@{upstream}" magit-buffer-log-args)
|
||||
(magit--insert-log nil "..@{upstream}" magit-buffer-log-args)
|
||||
(magit-log-insert-child-count))))
|
||||
|
||||
(magit-define-section-jumper magit-jump-to-unpulled-from-pushremote
|
||||
"Unpulled from <push-remote>" unpulled
|
||||
(concat ".." (magit-get-push-branch)))
|
||||
"Unpulled from <push-remote>" unpulled "..@{push}")
|
||||
|
||||
(defun magit-insert-unpulled-from-pushremote ()
|
||||
"Insert commits that haven't been pulled from the push-remote yet."
|
||||
(--when-let (magit-get-push-branch)
|
||||
(when-let* ((target (magit-get-push-branch))
|
||||
(range (concat ".." target)))
|
||||
(when (magit--insert-pushremote-log-p)
|
||||
(magit-insert-section (unpulled (concat ".." it) t)
|
||||
(magit-insert-section (unpulled range t)
|
||||
(magit-insert-heading
|
||||
(format (propertize "Unpulled from %s."
|
||||
'font-lock-face 'magit-section-heading)
|
||||
(propertize it 'font-lock-face 'magit-branch-remote)))
|
||||
(magit-insert-log (concat ".." it) magit-buffer-log-args)
|
||||
(propertize target 'font-lock-face 'magit-branch-remote)))
|
||||
(magit--insert-log nil range magit-buffer-log-args)
|
||||
(magit-log-insert-child-count)))))
|
||||
|
||||
(defvar magit-unpushed-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-log-section-map)
|
||||
map)
|
||||
"Keymap for `unpushed' sections.")
|
||||
(defvar-keymap magit-unpushed-section-map
|
||||
:doc "Keymap for `unpushed' sections."
|
||||
:parent magit-log-section-map)
|
||||
|
||||
(cl-defmethod magit-section-ident-value ((section magit-unpushed-section))
|
||||
"\"..@{push}\" cannot be used as the value because that is
|
||||
@@ -1864,7 +1915,7 @@ then show the last `magit-log-section-commit-count' commits."
|
||||
(format (propertize "Unmerged into %s."
|
||||
'font-lock-face 'magit-section-heading)
|
||||
(magit-get-upstream-branch)))
|
||||
(magit-insert-log "@{upstream}.." magit-buffer-log-args)
|
||||
(magit--insert-log nil "@{upstream}.." magit-buffer-log-args)
|
||||
(magit-log-insert-child-count))))
|
||||
|
||||
(defun magit-insert-recent-commits (&optional type value)
|
||||
@@ -1877,25 +1928,25 @@ Show the last `magit-log-section-commit-count' commits."
|
||||
(or value range)
|
||||
t)
|
||||
(magit-insert-heading "Recent commits")
|
||||
(magit-insert-log range
|
||||
(cons (format "-n%d" magit-log-section-commit-count)
|
||||
(--remove (string-prefix-p "-n" it)
|
||||
magit-buffer-log-args))))))
|
||||
(magit--insert-log nil range
|
||||
(cons (format "-n%d" magit-log-section-commit-count)
|
||||
(--remove (string-prefix-p "-n" it)
|
||||
magit-buffer-log-args))))))
|
||||
|
||||
(magit-define-section-jumper magit-jump-to-unpushed-to-pushremote
|
||||
"Unpushed to <push-remote>" unpushed
|
||||
(concat (magit-get-push-branch) ".."))
|
||||
"Unpushed to <push-remote>" unpushed "@{push}..")
|
||||
|
||||
(defun magit-insert-unpushed-to-pushremote ()
|
||||
"Insert commits that haven't been pushed to the push-remote yet."
|
||||
(--when-let (magit-get-push-branch)
|
||||
(when-let* ((target (magit-get-push-branch))
|
||||
(range (concat target "..")))
|
||||
(when (magit--insert-pushremote-log-p)
|
||||
(magit-insert-section (unpushed (concat it "..") t)
|
||||
(magit-insert-section (unpushed range t)
|
||||
(magit-insert-heading
|
||||
(format (propertize "Unpushed to %s."
|
||||
'font-lock-face 'magit-section-heading)
|
||||
(propertize it 'font-lock-face 'magit-branch-remote)))
|
||||
(magit-insert-log (concat it "..") magit-buffer-log-args)
|
||||
(propertize target 'font-lock-face 'magit-branch-remote)))
|
||||
(magit--insert-log nil range magit-buffer-log-args)
|
||||
(magit-log-insert-child-count)))))
|
||||
|
||||
(defun magit--insert-pushremote-log-p ()
|
||||
@@ -1924,7 +1975,7 @@ Show the last `magit-log-section-commit-count' commits."
|
||||
(defun magit-insert-unpulled-cherries ()
|
||||
"Insert section showing unpulled commits.
|
||||
Like `magit-insert-unpulled-from-upstream' but prefix each commit
|
||||
which has not been applied yet (i.e. a commit with a patch-id
|
||||
which has not been applied yet (i.e., a commit with a patch-id
|
||||
not shared with any local commit) with \"+\", and all others with
|
||||
\"-\"."
|
||||
(when (magit-git-success "rev-parse" "@{upstream}")
|
||||
@@ -1937,7 +1988,7 @@ not shared with any local commit) with \"+\", and all others with
|
||||
(defun magit-insert-unpushed-cherries ()
|
||||
"Insert section showing unpushed commits.
|
||||
Like `magit-insert-unpushed-to-upstream' but prefix each commit
|
||||
which has not been applied to upstream yet (i.e. a commit with
|
||||
which has not been applied to upstream yet (i.e., a commit with
|
||||
a patch-id not shared with any upstream commit) with \"+\", and
|
||||
all others with \"-\"."
|
||||
(when (magit-git-success "rev-parse" "@{upstream}")
|
||||
|
||||
Reference in New Issue
Block a user