equal
deleted
inserted
replaced
546 (if (= exit 0) |
546 (if (= exit 0) |
547 (let ((state (assoc (substring output 0 (min (length output) 2)) |
547 (let ((state (assoc (substring output 0 (min (length output) 2)) |
548 '(("M " . modified) |
548 '(("M " . modified) |
549 ("A " . added) |
549 ("A " . added) |
550 ("R " . removed) |
550 ("R " . removed) |
|
551 ("! " . deleted) |
551 ("? " . nil))))) |
552 ("? " . nil))))) |
552 (if state |
553 (if state |
553 (cdr state) |
554 (cdr state) |
554 'normal))))) |
555 'normal))))) |
555 |
|
556 (defun hg-tip () |
|
557 (split-string (hg-chomp (hg-run0 "-q" "tip")) ":")) |
|
558 |
556 |
559 (defmacro hg-view-output (args &rest body) |
557 (defmacro hg-view-output (args &rest body) |
560 "Execute BODY in a clean buffer, then quickly display that buffer. |
558 "Execute BODY in a clean buffer, then quickly display that buffer. |
561 If the buffer contains one line, its contents are displayed in the |
559 If the buffer contains one line, its contents are displayed in the |
562 minibuffer. Otherwise, the buffer is displayed in view-mode. |
560 minibuffer. Otherwise, the buffer is displayed in view-mode. |
635 "Update the modeline with the current status of a file. |
633 "Update the modeline with the current status of a file. |
636 An update occurs if optional argument FORCE is non-nil, |
634 An update occurs if optional argument FORCE is non-nil, |
637 hg-update-modeline is non-nil, or we have not yet checked the state of |
635 hg-update-modeline is non-nil, or we have not yet checked the state of |
638 the file." |
636 the file." |
639 (when (and (hg-root) (or force hg-update-modeline (not hg-mode))) |
637 (when (and (hg-root) (or force hg-update-modeline (not hg-mode))) |
640 (let ((status (hg-file-status buffer-file-name))) |
638 (let ((status (hg-file-status buffer-file-name)) |
|
639 (parents |
|
640 (split-string (hg-chomp |
|
641 (hg-run0 "parents" "--template" "{rev}\n")) "\n"))) |
641 (setq hg-status status |
642 (setq hg-status status |
642 hg-mode (and status (concat " Hg:" |
643 hg-mode (and status (concat " Hg:" |
643 (car (hg-tip)) |
644 (mapconcat 'identity parents "+") |
644 (cdr (assq status |
645 (cdr (assq status |
645 '((normal . "") |
646 '((normal . "") |
646 (removed . "r") |
647 (removed . "r") |
647 (added . "a") |
648 (added . "a") |
648 (modified . "m"))))))) |
649 (modified . "m"))))))) |