update packages and add valign
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-log.el --- Inspect Git history -*- lexical-binding:t; coding:utf-8 -*-
|
||||
|
||||
;; Copyright (C) 2008-2025 The Magit Project Contributors
|
||||
;; Copyright (C) 2008-2026 The Magit Project Contributors
|
||||
|
||||
;; Author: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
|
||||
;; Maintainer: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
|
||||
@@ -374,6 +374,12 @@ commits before and half after."
|
||||
:group 'magit-log
|
||||
:type 'integer)
|
||||
|
||||
;;; Variables
|
||||
|
||||
(defvar-local magit-buffer-log-revisions nil)
|
||||
(defvar-local magit-buffer-log-args nil)
|
||||
(defvar-local magit-buffer-log-files nil)
|
||||
|
||||
;;; Arguments
|
||||
;;;; Prefix Classes
|
||||
|
||||
@@ -569,19 +575,19 @@ commits before and half after."
|
||||
("b" "buffer lock" magit-toggle-buffer-lock)]]
|
||||
(interactive)
|
||||
(cond
|
||||
((not (eq transient-current-command 'magit-log-refresh))
|
||||
(pcase major-mode
|
||||
('magit-reflog-mode
|
||||
(user-error "Cannot change log arguments in reflog buffers"))
|
||||
('magit-cherry-mode
|
||||
(user-error "Cannot change log arguments in cherry buffers")))
|
||||
(transient-setup 'magit-log-refresh))
|
||||
(t
|
||||
(pcase-let ((`(,args ,files) (magit-log-arguments)))
|
||||
(setq magit-buffer-log-args args)
|
||||
(unless (derived-mode-p 'magit-log-select-mode)
|
||||
(setq magit-buffer-log-files files)))
|
||||
(magit-refresh))))
|
||||
((not (eq transient-current-command 'magit-log-refresh))
|
||||
(pcase major-mode
|
||||
('magit-reflog-mode
|
||||
(user-error "Cannot change log arguments in reflog buffers"))
|
||||
('magit-cherry-mode
|
||||
(user-error "Cannot change log arguments in cherry buffers")))
|
||||
(transient-setup 'magit-log-refresh))
|
||||
(t
|
||||
(pcase-let ((`(,args ,files) (magit-log-arguments)))
|
||||
(setq magit-buffer-log-args args)
|
||||
(unless (derived-mode-p 'magit-log-select-mode)
|
||||
(setq magit-buffer-log-files files)))
|
||||
(magit-refresh))))
|
||||
|
||||
;;;; Infix Commands
|
||||
|
||||
@@ -696,26 +702,26 @@ When the upstream is a local branch, then also show its own
|
||||
upstream. When `HEAD' is detached, then show log for that, the
|
||||
previously checked out branch and its upstream and push-target."
|
||||
(interactive
|
||||
(cons (let ((current (magit-get-current-branch))
|
||||
head rebase target upstream upup)
|
||||
(unless current
|
||||
(setq rebase (magit-rebase--get-state-lines "head-name"))
|
||||
(cond (rebase
|
||||
(setq rebase (magit-ref-abbrev rebase))
|
||||
(setq current rebase)
|
||||
(setq head "HEAD"))
|
||||
((setq current (magit-get-previous-branch)))))
|
||||
(cond (current
|
||||
(setq current
|
||||
(magit--propertize-face current 'magit-branch-local))
|
||||
(setq target (magit-get-push-branch current t))
|
||||
(setq upstream (magit-get-upstream-branch current))
|
||||
(when upstream
|
||||
(setq upup (and (magit-local-branch-p upstream)
|
||||
(magit-get-upstream-branch upstream)))))
|
||||
((setq head "HEAD")))
|
||||
(delq nil (list current head target upstream upup)))
|
||||
(magit-log-arguments)))
|
||||
(cons (let ((current (magit-get-current-branch))
|
||||
head rebase target upstream upup)
|
||||
(unless current
|
||||
(setq rebase (magit-rebase--get-state-lines "head-name"))
|
||||
(cond (rebase
|
||||
(setq rebase (magit-ref-abbrev rebase))
|
||||
(setq current rebase)
|
||||
(setq head "HEAD"))
|
||||
((setq current (magit-get-previous-branch)))))
|
||||
(cond (current
|
||||
(setq current
|
||||
(magit--propertize-face current 'magit-branch-local))
|
||||
(setq target (magit-get-push-branch current t))
|
||||
(setq upstream (magit-get-upstream-branch current))
|
||||
(when upstream
|
||||
(setq upup (and (magit-local-branch-p upstream)
|
||||
(magit-get-upstream-branch upstream)))))
|
||||
((setq head "HEAD")))
|
||||
(delq nil (list current head target upstream upup)))
|
||||
(magit-log-arguments)))
|
||||
(magit-log-setup-buffer revs args files))
|
||||
|
||||
;;;###autoload
|
||||
@@ -779,7 +785,7 @@ restrict the log to the lines that the region touches."
|
||||
(require 'magit)
|
||||
(if-let ((file (magit-file-relative-name)))
|
||||
(magit-log-setup-buffer
|
||||
(list (or magit-buffer-refname
|
||||
(list (or magit-buffer-revision
|
||||
(magit-get-current-branch)
|
||||
"HEAD"))
|
||||
(let ((args (car (magit-log-arguments))))
|
||||
@@ -802,7 +808,7 @@ restrict the log to the lines that the region touches."
|
||||
(user-error "Buffer isn't visiting a file"))
|
||||
(or (funcall magit-log-trace-definition-function)
|
||||
(user-error "No function at point found"))
|
||||
(or magit-buffer-refname
|
||||
(or magit-buffer-revision
|
||||
(magit-get-current-branch)
|
||||
"HEAD")))
|
||||
(require 'magit)
|
||||
@@ -844,10 +850,10 @@ directly on BRANCH, then show approximately
|
||||
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 "Log merge of commit")))
|
||||
(list commit
|
||||
(magit-read-other-branch "Merged into" commit)))
|
||||
(magit-log-arguments)))
|
||||
(append (let ((commit (magit-read-branch-or-commit "Log merge of commit")))
|
||||
(list commit
|
||||
(magit-read-other-branch "Merged into" commit)))
|
||||
(magit-log-arguments)))
|
||||
(unless (magit-git-executable-find "git-when-merged")
|
||||
(user-error "This command requires git-when-merged (%s)"
|
||||
"https://github.com/mhagger/git-when-merged"))
|
||||
@@ -872,7 +878,7 @@ https://github.com/mhagger/git-when-merged."
|
||||
(to (if (<= to 0)
|
||||
branch
|
||||
(format "%s~%s" branch to))))
|
||||
(unless (magit-rev-verify-commit from)
|
||||
(unless (magit-commit-p from)
|
||||
(setq from (magit-git-string "rev-list" "--max-parents=0"
|
||||
commit)))
|
||||
(magit-log-setup-buffer (list (concat from ".." to))
|
||||
@@ -970,13 +976,13 @@ 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-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)))))
|
||||
(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))
|
||||
@@ -1020,16 +1026,16 @@ of the current repository first; creating it if necessary."
|
||||
(defun magit-shortlog-since (commit args)
|
||||
"Show a history summary for commits since REV."
|
||||
(interactive
|
||||
(list (magit-read-branch-or-commit "Shortlog since" (magit-get-current-tag))
|
||||
(transient-args 'magit-shortlog)))
|
||||
(list (magit-read-branch-or-commit "Shortlog since" (magit-get-current-tag))
|
||||
(transient-args 'magit-shortlog)))
|
||||
(magit-git-shortlog (concat commit "..") args))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-shortlog-range (rev-or-range args)
|
||||
"Show a history summary for commit or range REV-OR-RANGE."
|
||||
(interactive
|
||||
(list (magit-read-range-or-commit "Shortlog for revision or range")
|
||||
(transient-args 'magit-shortlog)))
|
||||
(list (magit-read-range-or-commit "Shortlog for revision or range")
|
||||
(transient-args 'magit-shortlog)))
|
||||
(magit-git-shortlog rev-or-range args))
|
||||
|
||||
;;;; Movement Commands
|
||||
@@ -1131,7 +1137,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(require 'magit)
|
||||
(with-current-buffer
|
||||
(magit-setup-buffer #'magit-log-mode locked
|
||||
(magit-buffer-revisions revs)
|
||||
(magit-buffer-log-revisions revs)
|
||||
(magit-buffer-log-args args)
|
||||
(magit-buffer-log-files files))
|
||||
(when (if focus
|
||||
@@ -1141,7 +1147,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(current-buffer)))
|
||||
|
||||
(defun magit-log-refresh-buffer ()
|
||||
(let ((revs magit-buffer-revisions)
|
||||
(let ((revs magit-buffer-log-revisions)
|
||||
(args magit-buffer-log-args)
|
||||
(files magit-buffer-log-files)
|
||||
(limit (magit-log-get-commit-limit)))
|
||||
@@ -1181,24 +1187,24 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
|
||||
(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))
|
||||
(cond ((not (member "--color" args))
|
||||
(setq magit-log--color-graph nil))
|
||||
((cond ((not (member "--graph" args)) t)
|
||||
((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)))
|
||||
(setq args (remove "--color" args))
|
||||
(setq magit-log--color-graph nil))
|
||||
((setq magit-log--color-graph t)))
|
||||
args)
|
||||
|
||||
(cl-defmethod magit-buffer-value (&context (major-mode magit-log-mode))
|
||||
(append magit-buffer-revisions
|
||||
(if (and magit-buffer-revisions magit-buffer-log-files)
|
||||
(append magit-buffer-log-revisions
|
||||
(if (and magit-buffer-log-revisions magit-buffer-log-files)
|
||||
(cons "--" magit-buffer-log-files)
|
||||
magit-buffer-log-files)))
|
||||
|
||||
@@ -1257,17 +1263,17 @@ Do not add this to a hook variable."
|
||||
(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?"))))
|
||||
((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 magit-log-trailer-labels
|
||||
(format "%%(trailers:%s%s)"
|
||||
@@ -1779,20 +1785,20 @@ Type \\[magit-log-select-quit] to abort without selecting a commit."
|
||||
|
||||
(defun magit-log-select-setup-buffer (revs args)
|
||||
(magit-setup-buffer #'magit-log-select-mode nil
|
||||
(magit-buffer-revisions revs)
|
||||
(magit-buffer-log-revisions revs)
|
||||
(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 t magit-buffer-revisions
|
||||
(magit--insert-log t magit-buffer-log-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)
|
||||
magit-buffer-log-revisions)
|
||||
|
||||
(defvar-local magit-log-select-pick-function nil)
|
||||
(defvar-local magit-log-select-quit-function nil)
|
||||
@@ -1881,11 +1887,14 @@ Type \\[magit-cherry-pick] to apply the commit at point.
|
||||
(magit-hack-dir-local-variables)
|
||||
(setq magit--imenu-group-types 'cherries))
|
||||
|
||||
(defvar-local magit-buffer-cherry-upstream nil)
|
||||
(defvar-local magit-buffer-cherry-range nil)
|
||||
|
||||
(defun magit-cherry-setup-buffer (head upstream)
|
||||
(magit-setup-buffer #'magit-cherry-mode nil
|
||||
(magit-buffer-refname head)
|
||||
(magit-buffer-upstream upstream)
|
||||
(magit-buffer-range (concat upstream ".." head))))
|
||||
(magit-buffer-cherry-upstream upstream)
|
||||
(magit-buffer-cherry-range (concat upstream ".." head))))
|
||||
|
||||
(defun magit-cherry-refresh-buffer ()
|
||||
(setq magit-section-insert-in-reverse t)
|
||||
@@ -1893,15 +1902,15 @@ Type \\[magit-cherry-pick] to apply the commit at point.
|
||||
(magit-run-section-hook 'magit-cherry-sections-hook)))
|
||||
|
||||
(cl-defmethod magit-buffer-value (&context (major-mode magit-cherry-mode))
|
||||
magit-buffer-range)
|
||||
magit-buffer-cherry-range)
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-cherry (head upstream)
|
||||
"Show commits in a branch that are not merged in the upstream branch."
|
||||
(interactive
|
||||
(let ((head (magit-read-branch "Cherry head")))
|
||||
(list head (magit-read-other-branch "Cherry upstream" head
|
||||
(magit-get-upstream-branch head)))))
|
||||
(let ((head (magit-read-branch "Cherry head")))
|
||||
(list head (magit-read-other-branch "Cherry upstream" head
|
||||
(magit-get-upstream-branch head)))))
|
||||
(require 'magit)
|
||||
(magit-cherry-setup-buffer head upstream))
|
||||
|
||||
@@ -1909,10 +1918,11 @@ Type \\[magit-cherry-pick] to apply the commit at point.
|
||||
"Insert headers appropriate for `magit-cherry-mode' buffers."
|
||||
(let ((branch (propertize magit-buffer-refname
|
||||
'font-lock-face 'magit-branch-local))
|
||||
(upstream (propertize magit-buffer-upstream 'font-lock-face
|
||||
(if (magit-local-branch-p magit-buffer-upstream)
|
||||
'magit-branch-local
|
||||
'magit-branch-remote))))
|
||||
(upstream (propertize
|
||||
magit-buffer-cherry-upstream 'font-lock-face
|
||||
(if (magit-local-branch-p magit-buffer-cherry-upstream)
|
||||
'magit-branch-local
|
||||
'magit-branch-remote))))
|
||||
(magit-insert-head-branch-header branch)
|
||||
(magit-insert-upstream-branch-header branch upstream "Upstream: ")
|
||||
(insert ?\n)))
|
||||
@@ -1923,7 +1933,7 @@ Type \\[magit-cherry-pick] to apply the commit at point.
|
||||
(magit-insert-heading t "Cherry commits")
|
||||
(magit-git-wash (apply-partially #'magit-log-wash-log 'cherry)
|
||||
"cherry" "-v" "--abbrev"
|
||||
magit-buffer-upstream
|
||||
magit-buffer-cherry-upstream
|
||||
magit-buffer-refname)))
|
||||
|
||||
;;; Log Sections
|
||||
@@ -2114,6 +2124,7 @@ all others with \"-\"."
|
||||
;; ("and>" . "cond-let--and>")
|
||||
;; ("and-let" . "cond-let--and-let")
|
||||
;; ("if-let" . "cond-let--if-let")
|
||||
;; ("when$" . "cond-let--when$")
|
||||
;; ("when-let" . "cond-let--when-let")
|
||||
;; ("while-let" . "cond-let--while-let")
|
||||
;; ("match-string" . "match-string")
|
||||
|
||||
Reference in New Issue
Block a user