593 |
593 |
594 (defun hg-path-status (root paths) |
594 (defun hg-path-status (root paths) |
595 "Return status of PATHS in repo ROOT as an alist. |
595 "Return status of PATHS in repo ROOT as an alist. |
596 Each entry is a pair (FILE-NAME . STATUS)." |
596 Each entry is a pair (FILE-NAME . STATUS)." |
597 (let ((s (apply 'hg-run "--cwd" root "status" "-marduc" paths)) |
597 (let ((s (apply 'hg-run "--cwd" root "status" "-marduc" paths)) |
598 result) |
598 result) |
599 (dolist (entry (split-string (hg-chomp (cdr s)) "\n") (nreverse result)) |
599 (dolist (entry (split-string (hg-chomp (cdr s)) "\n") (nreverse result)) |
600 (let ((state (cdr (assoc (substring entry 0 2) |
600 (let (state name) |
601 '(("M " . modified) |
601 (if (equal (substring entry 1 2) " ") |
602 ("A " . added) |
602 (setq state (cdr (assoc (substring entry 0 2) |
603 ("R " . removed) |
603 '(("M " . modified) |
604 ("! " . deleted) |
604 ("A " . added) |
605 ("C " . normal) |
605 ("R " . removed) |
606 ("I " . ignored) |
606 ("! " . deleted) |
607 ("? " . nil))))) |
607 ("C " . normal) |
608 (name (substring entry 2))) |
608 ("I " . ignored) |
609 (setq result (cons (cons name state) result)))))) |
609 ("? " . nil)))) |
|
610 name (substring entry 2)) |
|
611 (setq name (substring entry 0 (search ": " entry :from-end t)))) |
|
612 (setq result (cons (cons name state) result)))))) |
610 |
613 |
611 (defmacro hg-view-output (args &rest body) |
614 (defmacro hg-view-output (args &rest body) |
612 "Execute BODY in a clean buffer, then quickly display that buffer. |
615 "Execute BODY in a clean buffer, then quickly display that buffer. |
613 If the buffer contains one line, its contents are displayed in the |
616 If the buffer contains one line, its contents are displayed in the |
614 minibuffer. Otherwise, the buffer is displayed in view-mode. |
617 minibuffer. Otherwise, the buffer is displayed in view-mode. |
639 (setq hg-prev-buffer ,prev-buf) |
642 (setq hg-prev-buffer ,prev-buf) |
640 (hg-view-mode ,prev-buf ,@v-m-rest)))))) |
643 (hg-view-mode ,prev-buf ,@v-m-rest)))))) |
641 |
644 |
642 (put 'hg-view-output 'lisp-indent-function 1) |
645 (put 'hg-view-output 'lisp-indent-function 1) |
643 |
646 |
644 ;;; Context save and restore across revert. |
647 ;;; Context save and restore across revert and other operations. |
645 |
648 |
646 (defun hg-position-context (pos) |
649 (defun hg-position-context (pos) |
647 "Return information to help find the given position again." |
650 "Return information to help find the given position again." |
648 (let* ((end (min (point-max) (+ pos 98)))) |
651 (let* ((end (min (point-max) (+ pos 98)))) |
649 (list pos |
652 (list pos |