(vc-hg-registered): Replace if with when.
authorDan Nicolaescu <dann@ics.uci.edu>
Thu, 19 Jul 2007 23:51:28 +0000 (23:51 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Thu, 19 Jul 2007 23:51:28 +0000 (23:51 +0000)
(vc-hg-state): Deal with nonexistent files.

lisp/ChangeLog
lisp/vc-hg.el

index 1f81860131e645384b38aa5012dacc494ed9f4a5..4aeeddf5633764428b9afaa93aa875387041337a 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-19  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc-hg.el (vc-hg-registered): Replace if with when.
+       (vc-hg-state): Deal with nonexistent files.
+
 2007-07-18  Juanma Barranquero  <lekktu@gmail.com>
 
        * follow.el (follow-mode-hook, follow-mode-off-hook, follow-mode)
index 7048800923241f33675b212af0cd5ac08117366b..8df01a2cc60a845da4a36d1f1fee9594a00742e6 100644 (file)
@@ -4,7 +4,6 @@
 
 ;; Author: Ivan Kanis
 ;; Keywords: tools
-;; Version: 1889
 
 ;; This file is part of GNU Emacs.
 
 ;; 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'."
                    (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