Highlight refs according to their origin.

This commit is contained in:
Phil Jackson 2009-11-08 14:54:53 +00:00
parent d5b60fc53f
commit 02432300e1

View file

@ -220,14 +220,37 @@ Many Magit faces inherit from this one by default."
"Face for git tag labels shown in log buffer." "Face for git tag labels shown in log buffer."
:group 'magit) :group 'magit)
(defface magit-log-head-label (defface magit-log-head-label-remote
'((((class color) (background light)) '((((class color) (background light))
:background "spring green") :background "Grey11"
:foreground "OliveDrab4")
(((class color) (background dark)) (((class color) (background dark))
:background "DarkGreen")) :background "Grey11"
"Face for branch head labels shown in log buffer." :foreground "DarkSeaGreen2"))
"Face for remote branch head labels shown in log buffer."
:group 'magit) :group 'magit)
(defface magit-log-head-label-tags
'((((class color) (background light))
:background "Grey13"
:foreground "khaki4")
(((class color) (background dark))
:background "Grey13"
:foreground "khaki1"))
"Face for tag labels shown in log buffer."
:group 'magit)
(defface magit-log-head-label-local
'((((class color) (background light))
:background "Grey13"
:foreground "LightSkyBlue4")
(((class color) (background dark))
:background "Grey13"
:foreground "LightSkyBlue1"))
"Face for local branch head labels shown in log buffer."
:group 'magit)
;;; Macros ;;; Macros
(defmacro magit-with-refresh (&rest body) (defmacro magit-with-refresh (&rest body)
@ -1844,16 +1867,22 @@ string which will represent the log line.")
(defun magit-present-log-line (graph sha1 refs message) (defun magit-present-log-line (graph sha1 refs message)
"The default log line generator." "The default log line generator."
(let* ((ref-re "\\(?:tag: \\)?refs/\\(?:tags\\|remotes\\|heads\\)/\\(.+\\)") (let* ((ref-re "\\(?:tag: \\)?refs/\\(tags\\|remotes\\|heads\\)/\\(.+\\)")
(string-refs (string-refs
(when refs (when refs
(concat (mapconcat (concat (mapconcat
(lambda (r) (lambda (r)
(propertize (propertize
(if (string-match ref-re r) (if (string-match ref-re r)
(match-string 1 r) (match-string 2 r)
r) r)
'face 'magit-log-head-label)) 'face (cond
((string= (match-string 1 r) "remotes")
'magit-log-head-label-remote)
((string= (match-string 1 r) "tags")
'magit-log-head-label-tags)
((string= (match-string 1 r) "heads")
'magit-log-head-label-local))))
refs refs
" ") " ")
" ")))) " "))))
@ -1876,7 +1905,9 @@ string which will represent the log line.")
(sha1 (match-string 2)) (sha1 (match-string 2))
(msg (match-string 4)) (msg (match-string 4))
(refs (when (match-string 3) (refs (when (match-string 3)
(split-string (match-string 3) "[(), ]" t)))) (remove-if (lambda (s)
(string= s "tag:"))
(split-string (match-string 3) "[(), ]" t)))))
(delete-region (point-at-bol) (point-at-eol)) (delete-region (point-at-bol) (point-at-eol))
(insert (magit-present-log-line chart sha1 refs msg)) (insert (magit-present-log-line chart sha1 refs msg))
(goto-char (point-at-bol)) (goto-char (point-at-bol))