# HG changeset patch # User Dan Nicolaescu # Date 1184889088 0 # Node ID 516805bc79888bba4beb087275fdd1586e620e64 # Parent dbaad02ecde9d00c082b456c3a59e8e9b67f4e1c (vc-hg-registered): Replace if with when. (vc-hg-state): Deal with nonexistent files. diff -r dbaad02ecde9 -r 516805bc7988 lisp/ChangeLog --- a/lisp/ChangeLog Wed Jul 18 22:20:42 2007 +0000 +++ b/lisp/ChangeLog Thu Jul 19 23:51:28 2007 +0000 @@ -1,3 +1,8 @@ +2007-07-19 Dan Nicolaescu + + * vc-hg.el (vc-hg-registered): Replace if with when. + (vc-hg-state): Deal with nonexistent files. + 2007-07-18 Juanma Barranquero * follow.el (follow-mode-hook, follow-mode-off-hook, follow-mode) diff -r dbaad02ecde9 -r 516805bc7988 lisp/vc-hg.el --- a/lisp/vc-hg.el Wed Jul 18 22:20:42 2007 +0000 +++ b/lisp/vc-hg.el Thu Jul 19 23:51:28 2007 +0000 @@ -4,7 +4,6 @@ ;; Author: Ivan Kanis ;; Keywords: tools -;; Version: 1889 ;; This file is part of GNU Emacs. @@ -137,8 +136,8 @@ ;; Modelled after the similar function in vc-bzr.el (defun vc-hg-registered (file) "Return non-nil if FILE is registered with hg." - (if (vc-hg-root file) ; short cut - (vc-hg-state file))) ; expensive + (when (vc-hg-root file) ; short cut + (vc-hg-state file))) ; expensive (defun vc-hg-state (file) "Hg-specific version of `vc-state'." @@ -159,13 +158,14 @@ (error nil))))))) (when (eq 0 status) (if (eq 0 (length out)) 'up-to-date - (let ((state (aref out 0))) - (cond - ((eq state ?A) 'edited) - ((eq state ?M) 'edited) - ((eq state ?R) nil) - ((eq state ??) nil) - (t 'up-to-date))))))) + (when (null (string-match ".*: No such file or directory$" out)) + (let ((state (aref out 0))) + (cond + ((eq state ?A) 'edited) + ((eq state ?M) 'edited) + ((eq state ?R) nil) + ((eq state ??) nil) + (t 'up-to-date)))))))) (defun vc-hg-dir-state (dir) (with-temp-buffer