From ad54692916a0b5352369d5ead8d81f20adf6e9d7 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 19 Jul 2007 23:51:28 +0000 Subject: [PATCH] (vc-hg-registered): Replace if with when. (vc-hg-state): Deal with nonexistent files. --- lisp/ChangeLog | 5 +++++ lisp/vc-hg.el | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1f81860131e..4aeeddf5633 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 --git a/lisp/vc-hg.el b/lisp/vc-hg.el index 70488009232..8df01a2cc60 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el @@ -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 -- 2.39.5