emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 452921c: * vc/vc-hg.el (vc-hg-state): Make FILE abs


From: Michael Albinus
Subject: [Emacs-diffs] master 452921c: * vc/vc-hg.el (vc-hg-state): Make FILE absolute. Handle the case
Date: Thu, 11 Dec 2014 10:12:35 +0000

branch: master
commit 452921cfc11b0e0f93130e57c4aa31036d91964e
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    * vc/vc-hg.el (vc-hg-state): Make FILE absolute.  Handle the case
    that there is empty output.
---
 lisp/ChangeLog   |    5 +++++
 lisp/vc/vc-hg.el |   28 +++++++++++++++-------------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2ed1f08..452f4c3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-11  Michael Albinus  <address@hidden>
+
+       * vc/vc-hg.el (vc-hg-state): Make FILE absolute.  Handle the case
+       that there is empty output.
+
 2014-12-11  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/eldoc.el (eldoc-documentation-function): Change default.
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index a56ed672..e049aab 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -188,6 +188,7 @@ highlighting the Log View buffer."
 
 (defun vc-hg-state (file)
   "Hg-specific version of `vc-state'."
+  (setq file (expand-file-name file))
   (let*
       ((status nil)
        (default-directory (file-name-directory file))
@@ -212,19 +213,20 @@ highlighting the Log View buffer."
                     ;; Some problem happened.  E.g. We can't find an `hg'
                     ;; executable.
                     (error nil)))))))
-    (when (eq 0 status)
-        (when (null (string-match ".*: No such file or directory$" out))
-          (let ((state (aref out 0)))
-            (cond
-             ((eq state ?=) 'up-to-date)
-             ((eq state ?A) 'added)
-             ((eq state ?M) 'edited)
-             ((eq state ?I) 'ignored)
-             ((eq state ?R) 'removed)
-             ((eq state ?!) 'missing)
-             ((eq state ??) 'unregistered)
-             ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this.
-             (t 'up-to-date)))))))
+    (when (and (eq 0 status)
+              (> (length out) 0)
+              (null (string-match ".*: No such file or directory$" out)))
+      (let ((state (aref out 0)))
+       (cond
+        ((eq state ?=) 'up-to-date)
+        ((eq state ?A) 'added)
+        ((eq state ?M) 'edited)
+        ((eq state ?I) 'ignored)
+        ((eq state ?R) 'removed)
+        ((eq state ?!) 'missing)
+        ((eq state ??) 'unregistered)
+        ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this.
+        (t 'up-to-date))))))
 
 (defun vc-hg-working-revision (file)
   "Hg-specific version of `vc-working-revision'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]