update packages
This commit is contained in:
@@ -128,7 +128,8 @@ part of the default value:
|
||||
(margin-body-face . (magit-blame-dimmed)))"
|
||||
:package-version '(magit . "2.13.0")
|
||||
:group 'magit-blame
|
||||
:type 'string)
|
||||
:type '(alist :key-type symbol
|
||||
:value-type (alist :key-type symbol :value-type sexp)))
|
||||
|
||||
(defcustom magit-blame-echo-style 'lines
|
||||
"The blame visualization style used by `magit-blame-echo'.
|
||||
@@ -265,21 +266,22 @@ Also see option `magit-blame-styles'."
|
||||
(magit-file-relative-name
|
||||
nil (not magit-buffer-file-name))))
|
||||
(line (format "%d,+1" (line-number-at-pos))))
|
||||
(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))
|
||||
(if (eobp)
|
||||
(unless noerror
|
||||
(error "Cannot get blame chunk at eob"))
|
||||
(car (magit-blame--parse-chunk type))))))
|
||||
(noerror nil)
|
||||
((error "Buffer does not visit a tracked file")))))))
|
||||
(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))
|
||||
(cond ((not (eobp))
|
||||
(car (magit-blame--parse-chunk type)))
|
||||
((not noerror)
|
||||
(error "Cannot get blame chunk at eob"))))))
|
||||
((not noerror)
|
||||
(error "Buffer does not visit a tracked file")))))))
|
||||
|
||||
(defun magit-blame-chunk-at (pos)
|
||||
(seq-some (##overlay-get % 'magit-blame-chunk)
|
||||
@@ -326,12 +328,6 @@ in `magit-blame-read-only-mode-map' instead."
|
||||
:lighter magit-blame-mode-lighter
|
||||
:interactive nil
|
||||
(cond (magit-blame-mode
|
||||
(unless arg
|
||||
;; Emacs < 28.1 doesn't support `:interactive'.
|
||||
(setq magit-blame-mode nil)
|
||||
(user-error
|
||||
(concat "Don't call `magit-blame-mode' directly; "
|
||||
"instead use `magit-blame'")))
|
||||
(add-hook 'after-save-hook #'magit-blame--refresh t t)
|
||||
(add-hook 'post-command-hook #'magit-blame-goto-chunk-hook t t)
|
||||
(add-hook 'before-revert-hook #'magit-blame--remove-overlays t t)
|
||||
@@ -422,7 +418,8 @@ modes is toggled, then this mode also gets toggled automatically.
|
||||
(magit-blame-mode 1))
|
||||
(message "Blaming...")
|
||||
(magit-blame-run-process
|
||||
(or magit-buffer-refname magit-buffer-revision)
|
||||
(and$ (or magit-buffer-refname magit-buffer-revision)
|
||||
(and (not (equal $ "{index}")) $))
|
||||
(magit-file-relative-name nil (not magit-buffer-file-name))
|
||||
(if (memq magit-blame-type '(final removal))
|
||||
(cons "--reverse" args)
|
||||
@@ -464,10 +461,10 @@ modes is toggled, then this mode also gets toggled automatically.
|
||||
(message "Blaming...done"))
|
||||
(magit-blame-assert-buffer process)
|
||||
(with-current-buffer (process-get process 'command-buf)
|
||||
(if magit-blame-mode
|
||||
(progn (magit-blame-mode -1)
|
||||
(message "Blaming...failed"))
|
||||
(message "Blaming...aborted"))))
|
||||
(cond (magit-blame-mode
|
||||
(magit-blame-mode -1)
|
||||
(message "Blaming...failed"))
|
||||
((message "Blaming...aborted")))))
|
||||
(kill-local-variable 'magit-blame-process))))
|
||||
|
||||
(defun magit-blame-process-filter (process string)
|
||||
@@ -501,22 +498,22 @@ modes is toggled, then this mode also gets toggled automatically.
|
||||
(buffer-substring-no-properties (point) (line-end-position))))
|
||||
(with-slots (orig-rev orig-file prev-rev prev-file)
|
||||
(setq chunk (magit-blame-chunk
|
||||
:orig-rev (match-string 1)
|
||||
:orig-line (string-to-number (match-string 2))
|
||||
:final-line (string-to-number (match-string 3))
|
||||
:num-lines (string-to-number (match-string 4))))
|
||||
:orig-rev (match-str 1)
|
||||
:orig-line (string-to-number (match-str 2))
|
||||
:final-line (string-to-number (match-str 3))
|
||||
:num-lines (string-to-number (match-str 4))))
|
||||
(forward-line)
|
||||
(let (done)
|
||||
(while (not done)
|
||||
(cond ((looking-at "^filename \\(.+\\)")
|
||||
(setq done t)
|
||||
(setf orig-file (magit-decode-git-path (match-string 1))))
|
||||
(setf orig-file (magit-decode-git-path (match-str 1))))
|
||||
((looking-at "^previous \\(.\\{40,\\}\\) \\(.+\\)")
|
||||
(setf prev-rev (match-string 1))
|
||||
(setf prev-file (magit-decode-git-path (match-string 2))))
|
||||
(setf prev-rev (match-str 1))
|
||||
(setf prev-file (magit-decode-git-path (match-str 2))))
|
||||
((looking-at "^\\([^ ]+\\) \\(.+\\)")
|
||||
(push (cons (match-string 1)
|
||||
(match-string 2))
|
||||
(push (cons (match-str 1)
|
||||
(match-str 2))
|
||||
revinfo)))
|
||||
(forward-line)))
|
||||
(when (and (eq type 'removal) prev-rev)
|
||||
@@ -753,18 +750,18 @@ modes is toggled, then this mode also gets toggled automatically.
|
||||
(delete-overlay ov)))))
|
||||
|
||||
(defun magit-blame-maybe-show-message ()
|
||||
(when (magit-blame--style-get 'show-message)
|
||||
(if-let ((msg (cdr (assoc "summary"
|
||||
(gethash (oref (magit-current-blame-chunk)
|
||||
orig-rev)
|
||||
magit-blame-cache)))))
|
||||
(progn (set-text-properties 0 (length msg) nil msg)
|
||||
(magit-msg "%S" msg))
|
||||
(magit-msg "Commit data not available yet. Still blaming."))))
|
||||
(cond-let
|
||||
((not (magit-blame--style-get 'show-message)))
|
||||
([msg (cdr (assoc "summary"
|
||||
(gethash (oref (magit-current-blame-chunk) orig-rev)
|
||||
magit-blame-cache)))]
|
||||
(set-text-properties 0 (length msg) nil msg)
|
||||
(magit-msg "%S" msg))
|
||||
((magit-msg "Commit data not available yet. Still blaming."))))
|
||||
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload (autoload 'magit-blame-echo "magit-blame" nil t)
|
||||
;;;###autoload(autoload 'magit-blame-echo "magit-blame" nil t)
|
||||
(transient-define-suffix magit-blame-echo (args)
|
||||
"For each line show the revision in which it was added.
|
||||
Show the information about the chunk at point in the echo area
|
||||
@@ -788,7 +785,7 @@ not turn on `read-only-mode'."
|
||||
(read-only-mode -1)
|
||||
(magit-blame--update-overlays)))
|
||||
|
||||
;;;###autoload (autoload 'magit-blame-addition "magit-blame" nil t)
|
||||
;;;###autoload(autoload 'magit-blame-addition "magit-blame" nil t)
|
||||
(transient-define-suffix magit-blame-addition (args)
|
||||
"For each line show the revision in which it was added."
|
||||
(interactive (list (magit-blame-arguments)))
|
||||
@@ -796,7 +793,7 @@ not turn on `read-only-mode'."
|
||||
(magit-blame--pre-blame-setup 'addition)
|
||||
(magit-blame--run args))
|
||||
|
||||
;;;###autoload (autoload 'magit-blame-removal "magit-blame" nil t)
|
||||
;;;###autoload(autoload 'magit-blame-removal "magit-blame" nil t)
|
||||
(transient-define-suffix magit-blame-removal (args)
|
||||
"For each line show the revision in which it was removed."
|
||||
:if-nil 'buffer-file-name
|
||||
@@ -807,7 +804,7 @@ not turn on `read-only-mode'."
|
||||
(magit-blame--pre-blame-setup 'removal)
|
||||
(magit-blame--run args))
|
||||
|
||||
;;;###autoload (autoload 'magit-blame-reverse "magit-blame" nil t)
|
||||
;;;###autoload(autoload 'magit-blame-reverse "magit-blame" nil t)
|
||||
(transient-define-suffix magit-blame-reverse (args)
|
||||
"For each line show the last revision in which it still exists."
|
||||
:if-nil 'buffer-file-name
|
||||
@@ -907,8 +904,9 @@ then also kill the buffer."
|
||||
#'previous-single-char-property-change
|
||||
#'next-single-char-property-change)
|
||||
pos 'magit-blame-chunk)))
|
||||
(when-let ((o (magit-blame--overlay-at pos))
|
||||
((equal (oref (magit-blame-chunk-at pos) orig-rev) rev)))
|
||||
(when-let
|
||||
((o (magit-blame--overlay-at pos))
|
||||
(_(equal (oref (magit-blame-chunk-at pos) orig-rev) rev)))
|
||||
(setq ov o))))
|
||||
(if ov
|
||||
(goto-char (overlay-start ov))
|
||||
@@ -943,7 +941,7 @@ instead of the hash, like `kill-ring-save' would."
|
||||
|
||||
;;; Popup
|
||||
|
||||
;;;###autoload (autoload 'magit-blame "magit-blame" nil t)
|
||||
;;;###autoload(autoload 'magit-blame "magit-blame" nil t)
|
||||
(transient-define-prefix magit-blame ()
|
||||
"Show the commits that added or removed lines in the visited file."
|
||||
:man-page "git-blame"
|
||||
@@ -1002,4 +1000,15 @@ instead of the hash, like `kill-ring-save' would."
|
||||
|
||||
;;; _
|
||||
(provide 'magit-blame)
|
||||
;; 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-blame.el ends here
|
||||
|
||||
Reference in New Issue
Block a user