update packages

This commit is contained in:
2025-11-25 19:52:03 +01:00
parent 14ba373378
commit dbbae92267
280 changed files with 13451 additions and 11207 deletions

View File

@@ -314,7 +314,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
(magit-buffer-arguments args)))
(defun magit-refs-refresh-buffer ()
(setq magit-set-buffer-margin-refresh (not (magit-buffer-margin-p)))
(setq magit--right-margin-delayed (not (magit--right-margin-active)))
(unless (magit-rev-verify magit-buffer-upstream)
(setq magit-refs-show-commit-count nil))
(magit-set-header-line-format
@@ -329,7 +329,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
;;; Commands
;;;###autoload (autoload 'magit-show-refs "magit-refs" nil t)
;;;###autoload(autoload 'magit-show-refs "magit-refs" nil t)
(transient-define-prefix magit-show-refs (&optional transient)
"List and compare references in a dedicated buffer."
:man-page "git-branch"
@@ -356,22 +356,16 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
(defun magit-show-refs-arguments (&optional use-buffer-args)
(unless use-buffer-args
(setq use-buffer-args magit-direct-use-buffer-arguments))
(let (args)
(cond
((eq transient-current-command 'magit-show-refs)
(setq args (transient-args 'magit-show-refs)))
((eq major-mode 'magit-refs-mode)
(setq args magit-buffer-arguments))
((and (memq use-buffer-args '(always selected))
(and-let* ((buffer (magit-get-mode-buffer
'magit-refs-mode nil
(eq use-buffer-args 'selected))))
(progn
(setq args (buffer-local-value 'magit-buffer-arguments buffer))
t))))
(t
(setq args (alist-get 'magit-show-refs transient-values))))
args))
(cond-let*
((eq transient-current-command 'magit-show-refs)
(transient-args 'magit-show-refs))
((eq major-mode 'magit-refs-mode)
magit-buffer-arguments)
([_(memq use-buffer-args '(always selected))]
[buffer (magit-get-mode-buffer 'magit-refs-mode nil
(eq use-buffer-args 'selected))]
(buffer-local-value 'magit-buffer-arguments buffer))
((alist-get 'magit-show-refs transient-values))))
(transient-define-argument magit-for-each-ref:--contains ()
:description "Contains"
@@ -441,47 +435,48 @@ different, but only if you have customized the option
`magit-visit-ref-behavior' (which see). When invoked from a
menu this command always behaves like `magit-show-commit'."
(interactive)
(if (and (derived-mode-p 'magit-refs-mode)
(magit-section-match '(branch tag))
(not (magit-menu-position)))
(let ((ref (oref (magit-current-section) value)))
(cond (current-prefix-arg
(cond ((memq 'focus-on-ref magit-visit-ref-behavior)
(magit-refs-setup-buffer ref (magit-show-refs-arguments)))
(magit-visit-ref-behavior
;; Don't prompt for commit to visit.
(let ((current-prefix-arg nil))
(call-interactively #'magit-show-commit)))))
((and (memq 'create-branch magit-visit-ref-behavior)
(magit-section-match [branch remote]))
(let ((branch (cdr (magit-split-branch-name ref))))
(if (magit-branch-p branch)
(if (magit-rev-eq branch ref)
(magit-call-git "checkout" branch)
(setq branch (propertize branch 'face 'magit-branch-local))
(setq ref (propertize ref 'face 'magit-branch-remote))
(pcase (prog1 (read-char-choice (format (propertize "\
(cond-let
((not (and (derived-mode-p 'magit-refs-mode)
(magit-section-match '(branch tag))
(not (magit-menu-position))))
(call-interactively #'magit-show-commit))
[[ref (oref (magit-current-section) value)]]
((and current-prefix-arg
(memq 'focus-on-ref magit-visit-ref-behavior))
(magit-refs-setup-buffer ref (magit-show-refs-arguments)))
((and current-prefix-arg
magit-visit-ref-behavior
;; Don't prompt for commit to visit.
(let ((current-prefix-arg nil))
(call-interactively #'magit-show-commit))))
((and (memq 'create-branch magit-visit-ref-behavior)
(magit-section-match [branch remote]))
(let ((branch (cdr (magit-split-branch-name ref))))
(if (magit-branch-p branch)
(if (magit-rev-eq branch ref)
(magit-call-git "checkout" branch)
(setq branch (propertize branch 'face 'magit-branch-local))
(setq ref (propertize ref 'face 'magit-branch-remote))
(pcase (prog1 (read-char-choice (format (propertize "\
Branch %s already exists.
[c]heckout %s as-is
[r]reset %s to %s and checkout %s
[a]bort " 'face 'minibuffer-prompt) branch branch branch ref branch)
'(?c ?r ?a))
(message "")) ; otherwise prompt sticks
(?c (magit-call-git "checkout" branch))
(?r (magit-call-git "checkout" "-B" branch ref))
(?a (user-error "Abort"))))
(magit-call-git "checkout" "-b" branch ref))
(setq magit-buffer-upstream branch)
(magit-refresh)))
((or (memq 'checkout-any magit-visit-ref-behavior)
(and (memq 'checkout-branch magit-visit-ref-behavior)
(magit-section-match [branch local])))
(magit-call-git "checkout" ref)
(setq magit-buffer-upstream ref)
(magit-refresh))
(t
(call-interactively #'magit-show-commit))))
(call-interactively #'magit-show-commit)))
'(?c ?r ?a))
(message "")) ; otherwise prompt sticks
(?c (magit-call-git "checkout" branch))
(?r (magit-call-git "checkout" "-B" branch ref))
(?a (user-error "Abort"))))
(magit-call-git "checkout" "-b" branch ref))
(setq magit-buffer-upstream branch)
(magit-refresh)))
((or (memq 'checkout-any magit-visit-ref-behavior)
(and (memq 'checkout-branch magit-visit-ref-behavior)
(magit-section-match [branch local])))
(magit-call-git "checkout" ref)
(setq magit-buffer-upstream ref)
(magit-refresh))
((call-interactively #'magit-show-commit))))
;;; Sections
@@ -501,6 +496,10 @@ Branch %s already exists.
"<2>" (magit-menu-item "Delete %m" #'magit-branch-delete)
"<1>" (magit-menu-item "Visit commit" #'magit-visit-ref))
(defvar-keymap magit-shelved-branch-section-map
:doc "Keymap for `shelved-branch' sections."
"<remap> <magit-delete-thing>" #'magit-delete-shelved-branch)
(defvar-keymap magit-tag-section-map
:doc "Keymap for `tag' sections."
"<remap> <magit-delete-thing>" #'magit-tag-delete
@@ -509,8 +508,8 @@ Branch %s already exists.
"<1>" (magit-menu-item "Visit %s" #'magit-visit-ref))
(defun magit--painted-branch-as-menu-section (section)
(and-let* ((branch (and (magit-section-match 'commit)
(magit--painted-branch-at-point))))
(and-let ((_(magit-section-match 'commit))
(branch (magit--painted-branch-at-point)))
(let ((dummy (magit-section :type 'branch :value branch)))
(oset dummy keymap magit-branch-section-map)
(dolist (slot '(start content hidden parent children))
@@ -547,8 +546,8 @@ line is inserted at all."
(magit-insert-heading (length tags) "Tags")
(dolist (tag tags)
(string-match "^\\([^ \t]+\\)[ \t]+\\([^ \t\n].*\\)?" tag)
(let ((tag (match-string 1 tag))
(msg (match-string 2 tag)))
(let ((tag (match-str 1 tag))
(msg (match-str 2 tag)))
(when (magit-refs--insert-refname-p tag)
(magit-insert-section (tag tag t)
(magit-insert-heading
@@ -561,8 +560,8 @@ line is inserted at all."
(length tag)))
?\s)
(and msg (magit-log--wash-summary msg)))
(when (and magit-refs-margin-for-tags (magit-buffer-margin-p))
(magit-refs--format-margin tag))
(when magit-refs-margin-for-tags
(magit-refs--maybe-format-margin tag))
(magit-refs--insert-cherry-commits tag)))))
(insert ?\n)
(magit-make-margin-overlay)))))
@@ -616,8 +615,7 @@ line is inserted at all."
(length abbrev)))
?\s)
(and msg (magit-log--wash-summary msg))))
(when (magit-buffer-margin-p)
(magit-refs--format-margin branch))
(magit-refs--maybe-format-margin branch)
(magit-refs--insert-cherry-commits branch))))))))
(insert ?\n)
(magit-make-margin-overlay))))
@@ -633,8 +631,7 @@ line is inserted at all."
(or branch (magit-rev-parse "HEAD"))
t)
(apply #'magit-insert-heading strings)
(when (magit-buffer-margin-p)
(magit-refs--format-margin branch))
(magit-refs--maybe-format-margin branch)
(magit-refs--insert-cherry-commits branch))))
(insert ?\n)
(magit-make-margin-overlay)))
@@ -642,14 +639,13 @@ line is inserted at all."
(defun magit-insert-shelved-branches ()
"Insert sections showing all shelved branches."
(when-let ((refs (magit-list-refs "refs/shelved/")))
(magit-insert-section (shelved nil)
(magit-insert-section (shelved nil t)
(magit-insert-heading t "Shelved branches")
(dolist (ref (nreverse refs))
(magit-insert-section (shelved-branch ref t)
(magit-insert-heading
" " (magit--propertize-face (substring ref 13) 'magit-refname))
(when (magit-buffer-margin-p)
(magit-refs--format-margin ref))
(magit-refs--maybe-format-margin ref)
(magit-refs--insert-cherry-commits ref)))
(insert ?\n)
(magit-make-margin-overlay))))
@@ -709,20 +705,20 @@ line is inserted at all."
(string-match "ahead \\([0-9]+\\)" u:track)
(magit--propertize-face
(concat (and magit-refs-pad-commit-counts " ")
(match-string 1 u:track)
(match-str 1 u:track)
">")
'magit-dimmed)))
(u:behind (and u:track
(string-match "behind \\([0-9]+\\)" u:track)
(magit--propertize-face
(concat "<"
(match-string 1 u:track)
(match-str 1 u:track)
(and magit-refs-pad-commit-counts " "))
'magit-dimmed)))
(p:ahead (and pushp p:track
(string-match "ahead \\([0-9]+\\)" p:track)
(magit--propertize-face
(concat (match-string 1 p:track)
(concat (match-str 1 p:track)
">"
(and magit-refs-pad-commit-counts " "))
'magit-branch-remote)))
@@ -730,7 +726,7 @@ line is inserted at all."
(string-match "behind \\([0-9]+\\)" p:track)
(magit--propertize-face
(concat "<"
(match-string 1 p:track)
(match-str 1 p:track)
(and magit-refs-pad-commit-counts " "))
'magit-dimmed))))
(list (1+ (length (concat branch-pretty u:ahead p:ahead u:behind)))
@@ -748,7 +744,7 @@ line is inserted at all."
(magit--propertize-face
push 'magit-branch-remote)
" "))
(if-let ((magit-refs-show-branch-descriptions)
(if-let ((_ magit-refs-show-branch-descriptions)
(desc (magit-get "branch" branch "description")))
(magit--propertize-face desc 'bold)
(and msg (magit-log--wash-summary msg))))))))
@@ -774,9 +770,9 @@ line is inserted at all."
(magit--propertize-face
(cond ((> ahead 0) (concat "<" (number-to-string ahead)))
((> behind 0) (concat (number-to-string behind) ">"))
(t "="))
("="))
'magit-dimmed)))
(t "")))))
("")))))
(defun magit-refs--propertize-branch (branch ref &optional head-face)
(let ((face (cdr (cl-find-if (pcase-lambda (`(,re . ,_))
@@ -804,11 +800,23 @@ line is inserted at all."
(message "No cherries for %s" ref)
(magit-make-margin-overlay)))))
(defun magit-refs--format-margin (rev)
(if-let ((line (magit-rev-format "%cN%x00%ct" rev)))
(apply #'magit-log-format-margin rev (split-string line "\0"))
(magit-make-margin-overlay)))
(defun magit-refs--maybe-format-margin (rev)
(when (magit--right-margin-active)
(if-let ((line (magit-rev-format "%cN%x00%ct" rev)))
(apply #'magit-log-format-margin rev (split-string line "\0"))
(magit-make-margin-overlay))))
;;; _
(provide 'magit-refs)
;; 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-refs.el ends here