Commit 15c5c970 authored by Dan Nicolaescu's avatar Dan Nicolaescu
Browse files

* vc.el: Add new backend function 'status-extra-headers.

(vc-default-status-extra-headers): New function.
(vc-status-headers): Call 'status-extra-headers.  Add colors.

* vc-git.el (vc-git-status-extra-headers): New function.
parent 1baf9da4
2008-03-28 Dan Nicolaescu <dann@ics.uci.edu>
* vc.el: Add new backend function 'status-extra-headers.
(vc-default-status-extra-headers): New function.
(vc-status-headers): Call 'status-extra-headers. Add colors.
* vc-git.el (vc-git-status-extra-headers): New function.
2008-03-28 Glenn Morris <rgm@gnu.org> 2008-03-28 Glenn Morris <rgm@gnu.org>
   
* calendar/cal-menu.el (cal-menu-holidays-menu) * calendar/cal-menu.el (cal-menu-holidays-menu)
......
...@@ -264,6 +264,18 @@ ...@@ -264,6 +264,18 @@
`(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer))) `(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer)))
(current-buffer))) (current-buffer)))
(defun vc-git-status-extra-headers (dir)
(let ((str (with-output-to-string
(with-current-buffer standard-output
(vc-git--out-ok "symbolic-ref" "HEAD")))))
(concat
(propertize "Branch : " 'face 'font-lock-type-face)
(propertize
(if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
(match-string 2 str)
"not (detached HEAD)")
'face 'font-lock-variable-name-face))))
;;; STATE-CHANGING FUNCTIONS ;;; STATE-CHANGING FUNCTIONS
(defun vc-git-create-repo () (defun vc-git-create-repo ()
......
...@@ -182,6 +182,10 @@ ...@@ -182,6 +182,10 @@
;; change. ;; change.
;; This is a replacement for dir-state. ;; This is a replacement for dir-state.
;; ;;
;; - status-extra-headers (dir)
;;
;; Return a string that will be added to the *vc-status* buffer header.
;;
;; * working-revision (file) ;; * working-revision (file)
;; ;;
;; Return the working revision of FILE. This is the revision fetched ;; Return the working revision of FILE. This is the revision fetched
...@@ -2655,11 +2659,17 @@ With prefix arg READ-SWITCHES, specify a value to override ...@@ -2655,11 +2659,17 @@ With prefix arg READ-SWITCHES, specify a value to override
(defvar vc-status nil) (defvar vc-status nil)
(defun vc-default-status-extra-headers (backend dir)
"Extra : Add backend specific headers here")
(defun vc-status-headers (backend dir) (defun vc-status-headers (backend dir)
(concat (concat
(format "VC backend : %s\n" backend) (propertize "VC backend : " 'face 'font-lock-type-face)
"Repository : The repository goes here\n" (propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face)
(format "Working dir: %s\n" dir))) (propertize "Working dir: " 'face 'font-lock-type-face)
(propertize (format "%s\n" dir) 'face 'font-lock-variable-name-face)
(vc-call-backend backend 'status-extra-headers dir)
"\n"))
(defun vc-status-printer (fileentry) (defun vc-status-printer (fileentry)
"Pretty print FILEENTRY." "Pretty print FILEENTRY."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment