comparison contrib/mercurial.el @ 2987:a7c4c7537999

mercurial.el: add hg-status.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 22 Aug 2006 11:37:18 -0700
parents b6e6d2a9c5bc
children 65efeb7b2c56
comparison
equal deleted inserted replaced
2986:b6e6d2a9c5bc 2987:a7c4c7537999
551 ("! " . deleted) 551 ("! " . deleted)
552 ("? " . nil))))) 552 ("? " . nil)))))
553 (if state 553 (if state
554 (cdr state) 554 (cdr state)
555 'normal))))) 555 'normal)))))
556
557 (defun hg-status (&rest paths)
558 "Return status of PATHS as an alist.
559 Each entry is a pair (FILE-NAME . STATUS)."
560 (let ((s (apply 'hg-run "status" "-marduc" paths))
561 result)
562 (dolist (entry (split-string (hg-chomp (cdr s)) "\n") (nreverse result))
563 (let ((state (cdr (assoc (substring entry 0 2)
564 '(("M " . modified)
565 ("A " . added)
566 ("R " . removed)
567 ("! " . deleted)
568 ("C " . normal)
569 ("I " . ignored)
570 ("? " . nil)))))
571 (name (substring entry 2)))
572 (setq result (cons (cons name state) result)))))))
556 573
557 (defmacro hg-view-output (args &rest body) 574 (defmacro hg-view-output (args &rest body)
558 "Execute BODY in a clean buffer, then quickly display that buffer. 575 "Execute BODY in a clean buffer, then quickly display that buffer.
559 If the buffer contains one line, its contents are displayed in the 576 If the buffer contains one line, its contents are displayed in the
560 minibuffer. Otherwise, the buffer is displayed in view-mode. 577 minibuffer. Otherwise, the buffer is displayed in view-mode.