update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-blame.el --- blame support for Magit -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2012-2021 The Magit Project Contributors
|
||||
;; Copyright (C) 2012-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)
|
||||
@@ -28,9 +30,6 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'subr-x))
|
||||
|
||||
(require 'magit)
|
||||
|
||||
;;; Options
|
||||
@@ -198,19 +197,19 @@ Also see option `magit-blame-styles'."
|
||||
Also see option `magit-blame-styles'."
|
||||
:group 'magit-faces)
|
||||
|
||||
(defface magit-blame-summary nil
|
||||
(defface magit-blame-summary '((t nil))
|
||||
"Face used for commit summaries when blaming."
|
||||
:group 'magit-faces)
|
||||
|
||||
(defface magit-blame-hash nil
|
||||
(defface magit-blame-hash '((t nil))
|
||||
"Face used for commit hashes when blaming."
|
||||
:group 'magit-faces)
|
||||
|
||||
(defface magit-blame-name nil
|
||||
(defface magit-blame-name '((t nil))
|
||||
"Face used for author and committer names when blaming."
|
||||
:group 'magit-faces)
|
||||
|
||||
(defface magit-blame-date nil
|
||||
(defface magit-blame-date '((t nil))
|
||||
"Face used for dates when blaming."
|
||||
:group 'magit-faces)
|
||||
|
||||
@@ -228,25 +227,27 @@ Also see option `magit-blame-styles'."
|
||||
;; filename <orig-file>
|
||||
(orig-file)))
|
||||
|
||||
(defun magit-current-blame-chunk (&optional type)
|
||||
(defun magit-current-blame-chunk (&optional type noerror)
|
||||
(or (and (not (and type (not (eq type magit-blame-type))))
|
||||
(magit-blame-chunk-at (point)))
|
||||
(and type
|
||||
(let ((rev (or magit-buffer-refname magit-buffer-revision))
|
||||
(file (magit-file-relative-name nil (not magit-buffer-file-name)))
|
||||
(file (and (not (derived-mode-p 'dired-mode))
|
||||
(magit-file-relative-name
|
||||
nil (not magit-buffer-file-name))))
|
||||
(line (format "%i,+1" (line-number-at-pos))))
|
||||
(unless file
|
||||
(error "Buffer does not visit a tracked file"))
|
||||
(with-temp-buffer
|
||||
(magit-with-toplevel
|
||||
(magit-git-insert
|
||||
"blame" "--porcelain"
|
||||
(if (memq magit-blame-type '(final removal))
|
||||
(cons "--reverse" (magit-blame-arguments))
|
||||
(magit-blame-arguments))
|
||||
"-L" line rev "--" file)
|
||||
(goto-char (point-min))
|
||||
(car (magit-blame--parse-chunk type))))))))
|
||||
(cond (file (with-temp-buffer
|
||||
(magit-with-toplevel
|
||||
(magit-git-insert
|
||||
"blame" "--porcelain"
|
||||
(if (memq magit-blame-type '(final removal))
|
||||
(cons "--reverse" (magit-blame-arguments))
|
||||
(magit-blame-arguments))
|
||||
"-L" line rev "--" file)
|
||||
(goto-char (point-min))
|
||||
(car (magit-blame--parse-chunk type)))))
|
||||
(noerror nil)
|
||||
(t (error "Buffer does not visit a tracked file")))))))
|
||||
|
||||
(defun magit-blame-chunk-at (pos)
|
||||
(--some (overlay-get it 'magit-blame-chunk)
|
||||
@@ -489,10 +490,10 @@ modes is toggled, then this mode also gets toggled automatically.
|
||||
(while (not done)
|
||||
(cond ((looking-at "^filename \\(.+\\)")
|
||||
(setq done t)
|
||||
(setf orig-file (match-string 1)))
|
||||
(setf orig-file (magit-decode-git-path (match-string 1))))
|
||||
((looking-at "^previous \\(.\\{40\\}\\) \\(.+\\)")
|
||||
(setf prev-rev (match-string 1))
|
||||
(setf prev-file (match-string 2)))
|
||||
(setf prev-file (magit-decode-git-path (match-string 2))))
|
||||
((looking-at "^\\([^ ]+\\) \\(.+\\)")
|
||||
(push (cons (match-string 1)
|
||||
(match-string 2)) revinfo)))
|
||||
@@ -702,9 +703,9 @@ modes is toggled, then this mode also gets toggled automatically.
|
||||
(when (magit-blame--style-get 'show-message)
|
||||
(let ((message-log-max 0))
|
||||
(if-let ((msg (cdr (assoc "summary"
|
||||
(gethash (oref (magit-current-blame-chunk)
|
||||
orig-rev)
|
||||
magit-blame-cache)))))
|
||||
(gethash (oref (magit-current-blame-chunk)
|
||||
orig-rev)
|
||||
magit-blame-cache)))))
|
||||
(progn (set-text-properties 0 (length msg) nil msg)
|
||||
(message msg))
|
||||
(message "Commit data not available yet. Still blaming.")))))
|
||||
@@ -896,6 +897,7 @@ instead of the hash, like `kill-ring-save' would."
|
||||
["Arguments"
|
||||
("-w" "Ignore whitespace" "-w")
|
||||
("-r" "Do not treat root commits as boundaries" "--root")
|
||||
("-P" "Follow only first parent" "--first-parent")
|
||||
(magit-blame:-M)
|
||||
(magit-blame:-C)]
|
||||
["Actions"
|
||||
@@ -915,12 +917,14 @@ instead of the hash, like `kill-ring-save' would."
|
||||
:description "Detect lines moved or copied within a file"
|
||||
:class 'transient-option
|
||||
:argument "-M"
|
||||
:allow-empty t
|
||||
:reader 'transient-read-number-N+)
|
||||
|
||||
(transient-define-argument magit-blame:-C ()
|
||||
:description "Detect lines moved or copied between files"
|
||||
:class 'transient-option
|
||||
:argument "-C"
|
||||
:allow-empty t
|
||||
:reader 'transient-read-number-N+)
|
||||
|
||||
;;; Utilities
|
||||
|
||||
Reference in New Issue
Block a user