History browsing improvements.
* magit.el (magit-show-commit): Make sure we use the right directory. (magit-wash-log): Deal with the commit SHA1 not being at the beginning of the line. (magit-browse-log): Add "--graph" for extra niceness. (magit-log-commit): New.
This commit is contained in:
parent
0b3118061d
commit
47d9520d42
1 changed files with 14 additions and 5 deletions
19
magit.el
19
magit.el
|
@ -692,6 +692,8 @@ pushed.
|
||||||
(define-key magit-log-mode-map (kbd "R") 'magit-revert-commit)
|
(define-key magit-log-mode-map (kbd "R") 'magit-revert-commit)
|
||||||
(define-key magit-log-mode-map (kbd "P") 'magit-pick-commit)
|
(define-key magit-log-mode-map (kbd "P") 'magit-pick-commit)
|
||||||
(define-key magit-log-mode-map (kbd "C") 'magit-checkout-commit)
|
(define-key magit-log-mode-map (kbd "C") 'magit-checkout-commit)
|
||||||
|
(define-key magit-log-mode-map (kbd "l") 'magit-log-commit)
|
||||||
|
(define-key magit-log-mode-map (kbd "L") 'magit-browse-branch-log)
|
||||||
(define-key magit-log-mode-map (kbd "q") 'magit-quit))
|
(define-key magit-log-mode-map (kbd "q") 'magit-quit))
|
||||||
|
|
||||||
(defvar magit-log-mode-hook nil)
|
(defvar magit-log-mode-hook nil)
|
||||||
|
@ -727,14 +729,20 @@ pushed.
|
||||||
(interactive)
|
(interactive)
|
||||||
(magit-run "git" "checkout" (magit-commit-at-point)))
|
(magit-run "git" "checkout" (magit-commit-at-point)))
|
||||||
|
|
||||||
|
(defun magit-log-commit ()
|
||||||
|
(interactive)
|
||||||
|
(magit-browse-log (magit-commit-at-point)))
|
||||||
|
|
||||||
(defun magit-show-commit ()
|
(defun magit-show-commit ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((commit (magit-commit-at-point))
|
(let ((dir default-directory)
|
||||||
|
(commit (magit-commit-at-point))
|
||||||
(buf (get-buffer-create "*magit-commit*")))
|
(buf (get-buffer-create "*magit-commit*")))
|
||||||
(display-buffer buf)
|
(display-buffer buf)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(set-buffer buf)
|
(set-buffer buf)
|
||||||
(setq buffer-read-only t)
|
(setq buffer-read-only t)
|
||||||
|
(setq default-directory dir)
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(magit-insert-section 'commit nil 'magit-wash-diff
|
(magit-insert-section 'commit nil 'magit-wash-diff
|
||||||
|
@ -747,10 +755,10 @@ pushed.
|
||||||
(defun magit-wash-log (status)
|
(defun magit-wash-log (status)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (not (eobp))
|
(while (not (eobp))
|
||||||
(when (looking-at "[0-9a-fA-F]+")
|
(when (search-forward-regexp "[0-9a-fA-F]\\{40\\}" (line-end-position) t)
|
||||||
(let ((commit (match-string-no-properties 0)))
|
(let ((commit (match-string-no-properties 0)))
|
||||||
(delete-region (match-beginning 0) (match-end 0))
|
(delete-region (match-beginning 0) (match-end 0))
|
||||||
(beginning-of-line)
|
(goto-char (match-beginning 0))
|
||||||
(fixup-whitespace)
|
(fixup-whitespace)
|
||||||
(put-text-property (line-beginning-position) (line-end-position)
|
(put-text-property (line-beginning-position) (line-end-position)
|
||||||
'magit-info (list 'commit commit))))
|
'magit-info (list 'commit commit))))
|
||||||
|
@ -765,8 +773,9 @@ pushed.
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(magit-insert-section 'history "History" 'magit-wash-log
|
(magit-insert-section 'history (format "History of %s" head)
|
||||||
"git" "log" "--max-count=100"
|
'magit-wash-log
|
||||||
|
"git" "log" "--graph" "--max-count=10000"
|
||||||
"--pretty=oneline" head)))))
|
"--pretty=oneline" head)))))
|
||||||
|
|
||||||
(defun magit-browse-branch-log ()
|
(defun magit-browse-branch-log ()
|
||||||
|
|
Loading…
Reference in a new issue