Mercurial > hg
changeset 3005:18c661e9abd9
mercurial.el: deal with more vagaries of "hg status".
If we run "hg status" on a file that does not exist, it prints an error
message. Attempt to extract the name of the file.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 22 Aug 2006 15:15:52 -0700 |
parents | ac74046f8f58 |
children | 7017fc9a9478 |
files | contrib/mercurial.el |
diffstat | 1 files changed, 16 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/mercurial.el Tue Aug 22 15:14:35 2006 -0700 +++ b/contrib/mercurial.el Tue Aug 22 15:15:52 2006 -0700 @@ -595,18 +595,21 @@ "Return status of PATHS in repo ROOT as an alist. Each entry is a pair (FILE-NAME . STATUS)." (let ((s (apply 'hg-run "--cwd" root "status" "-marduc" paths)) - result) - (dolist (entry (split-string (hg-chomp (cdr s)) "\n") (nreverse result)) - (let ((state (cdr (assoc (substring entry 0 2) - '(("M " . modified) - ("A " . added) - ("R " . removed) - ("! " . deleted) - ("C " . normal) - ("I " . ignored) - ("? " . nil))))) - (name (substring entry 2))) - (setq result (cons (cons name state) result)))))) + result) + (dolist (entry (split-string (hg-chomp (cdr s)) "\n") (nreverse result)) + (let (state name) + (if (equal (substring entry 1 2) " ") + (setq state (cdr (assoc (substring entry 0 2) + '(("M " . modified) + ("A " . added) + ("R " . removed) + ("! " . deleted) + ("C " . normal) + ("I " . ignored) + ("? " . nil)))) + name (substring entry 2)) + (setq name (substring entry 0 (search ": " entry :from-end t)))) + (setq result (cons (cons name state) result)))))) (defmacro hg-view-output (args &rest body) "Execute BODY in a clean buffer, then quickly display that buffer. @@ -641,7 +644,7 @@ (put 'hg-view-output 'lisp-indent-function 1) -;;; Context save and restore across revert. +;;; Context save and restore across revert and other operations. (defun hg-position-context (pos) "Return information to help find the given position again."