Function: vc-hg-mode-line-string

vc-hg-mode-line-string is a byte-compiled function defined in vc-hg.el.gz.

Signature

(vc-hg-mode-line-string FILE)

Documentation

Hg-specific version of vc-mode-line-string.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-hg.el.gz
(defun vc-hg-mode-line-string (file)
  "Hg-specific version of `vc-mode-line-string'."
  (let* ((backend-name "Hg")
         (truename (file-truename file))
         (state (vc-state truename))
         (state-echo nil)
         (face nil)
         (rev (and state
                   (let ((default-directory
                          (expand-file-name (vc-hg-root truename))))
                     (vc-hg--symbolic-revision
                      "."
                      (and vc-hg-use-file-version-for-mode-line-version
                           truename)))))
         (rev (or rev "???")))
    (propertize
     (cond ((or (eq state 'up-to-date)
                (eq state 'needs-update))
            (setq state-echo "Up to date file")
            (setq face 'vc-up-to-date-state)
            (concat backend-name "-" rev))
           ((eq state 'added)
            (setq state-echo "Locally added file")
            (setq face 'vc-locally-added-state)
            (concat backend-name "@" rev))
           ((eq state 'conflict)
            (setq state-echo "File contains conflicts after the last merge")
            (setq face 'vc-conflict-state)
            (concat backend-name "!" rev))
           ((eq state 'removed)
            (setq state-echo "File removed from the VC system")
            (setq face 'vc-removed-state)
            (concat backend-name "!" rev))
           ((eq state 'missing)
            (setq state-echo "File tracked by the VC system, but missing from the file system")
            (setq face 'vc-missing-state)
            (concat backend-name "?" rev))
           (t
            (setq state-echo "Locally modified file")
            (setq face 'vc-edited-state)
            (concat backend-name ":" rev)))
     'face face
     'help-echo (concat state-echo " under the " backend-name
                        " version control system"))))