bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18461: `vc-svn-registered' signals an error if a directory has be (r


From: Emilio Lopes
Subject: bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
Date: Mon, 15 Sep 2014 15:27:36 +0200

Here is an updated patch:

--- lisp/ChangeLog    2014-09-15 00:20:21 +0000
+++ lisp/ChangeLog    2014-09-15 13:22:54 +0000
@@ -1,3 +1,10 @@
+2014-09-15  Emilio C. Lopes  <eclig@gmx.net>
+
+    * vc/vc-svn.el (vc-svn-registered): `cd' to the project root, not
+    to the file's directory, in case the directory has been (re)moved,
+    and do this inside a `with-demoted-errors' form.
+    (vc-svn-state): Ditto, modulo `with-demoted-errors'.
+
 2014-09-15  Glenn Morris  <rgm@gnu.org>

     * image.el (image-multi-frame-p): Fix thinko - do not force

--- lisp/vc/vc-svn.el    2014-01-01 07:43:34 +0000
+++ lisp/vc/vc-svn.el    2014-09-15 13:22:54 +0000
@@ -135,30 +135,30 @@

 (defun vc-svn-registered (file)
   "Check if FILE is SVN registered."
-  (when (vc-svn-root file)
-    (with-temp-buffer
-      (cd (file-name-directory file))
-      (let* (process-file-side-effects
-         (status
-             (condition-case nil
-                 ;; Ignore all errors.
-                 (vc-svn-command t t file "status" "-v")
-               ;; Some problem happened.  E.g. We can't find an `svn'
-               ;; executable.  We used to only catch `file-error' but when
-               ;; the process is run on a remote host via Tramp, the error
-               ;; is only reported via the exit status which is turned into
-               ;; an `error' by vc-do-command.
-               (error nil))))
-        (when (eq 0 status)
-      (let ((parsed (vc-svn-parse-status file)))
-        (and parsed (not (memq parsed '(ignored unregistered))))))))))
+  (let ((dir (vc-svn-root file)))
+    (when dir
+      (with-temp-buffer
+        (let* ((process-file-side-effects nil)
+               (status
+                (with-demoted-errors "Error: %S"
+                  ;; In case some problem might happen.  E.g. We can't
+                  ;; find an `svn' executable.  We used to only catch
+                  ;; `file-error' but when the process is run on a
+                  ;; remote host via Tramp, the error is only reported
+                  ;; via the exit status which is turned into an
+                  ;; `error' by vc-do-command.
+                  (cd dir)
+                  (vc-svn-command t t file "status" "-v"))))
+          (when (eq 0 status)
+            (let ((parsed (vc-svn-parse-status file)))
+              (and parsed (not (memq parsed '(ignored unregistered)))))))))))

 (defun vc-svn-state (file &optional localp)
   "SVN-specific version of `vc-state'."
   (let (process-file-side-effects)
     (setq localp (or localp (vc-stay-local-p file 'SVN)))
     (with-temp-buffer
-      (cd (file-name-directory file))
+      (cd (vc-svn-root file))
       (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
       (vc-svn-parse-status file))))





reply via email to

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