unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
@ 2014-09-12 16:09 Emilio Lopes
  2014-09-12 17:28 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Emilio Lopes @ 2014-09-12 16:09 UTC (permalink / raw)
  To: 18461

Here is a typical backtrace:

    Debugger entered--Lisp error: (error "No such directory found via
CDPATH environment variable")
      signal(error ("No such directory found via CDPATH environment variable"))
      error("No such directory found via CDPATH environment variable")
      cd("~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      vc-svn-registered("~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      apply(vc-svn-registered
"~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      vc-call-backend(SVN registered
"~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      ...

The following patch seems to fix the problem for me.

Regards,

 Emílio

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog    2014-09-08 13:57:19 +0000
+++ lisp/ChangeLog    2014-09-12 16:00:36 +0000
@@ -1,3 +1,10 @@
+2014-09-12  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 the `ignore-errors' form.
+    (vc-svn-state): Ditto, modulo `ignore-errors'.
+
 2014-09-08  Sam Steingold  <sds@gnu.org>

     * progmodes/sql.el (sql-send-line-and-next): New command,

=== modified file 'lisp/vc/vc-svn.el'
--- lisp/vc/vc-svn.el    2014-01-01 07:43:34 +0000
+++ lisp/vc/vc-svn.el    2014-09-12 16:00:36 +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
+               (status
+                (ignore-errors
+                  ;; 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))))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
  2014-09-12 16:09 bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved Emilio Lopes
@ 2014-09-12 17:28 ` Stefan Monnier
  2014-09-12 20:36   ` Emilio Lopes
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2014-09-12 17:28 UTC (permalink / raw)
  To: Emilio Lopes; +Cc: 18461

> +                (ignore-errors
> +                  ;; 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"))))

Sounds OK, but I suggest we use with-demoted-errors, so the user is told
in case there's a problem.


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
  2014-09-12 17:28 ` Stefan Monnier
@ 2014-09-12 20:36   ` Emilio Lopes
  2014-09-15 13:27     ` Emilio Lopes
  0 siblings, 1 reply; 7+ messages in thread
From: Emilio Lopes @ 2014-09-12 20:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18461

2014-09-12 19:28 GMT+02:00 Stefan Monnier <monnier@iro.umontreal.ca>:
>> +                (ignore-errors
>> +                  ;; 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"))))
>
> Sounds OK, but I suggest we use with-demoted-errors, so the user is told
> in case there's a problem.

Makes sense, thanks for looking at it.  I'll submit a new patch the next days.

 Emílio





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
  2014-09-12 20:36   ` Emilio Lopes
@ 2014-09-15 13:27     ` Emilio Lopes
  2016-02-23 12:08       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Emilio Lopes @ 2014-09-15 13:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18461

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))))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
  2014-09-15 13:27     ` Emilio Lopes
@ 2016-02-23 12:08       ` Lars Ingebrigtsen
  2016-02-24  0:22         ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23 12:08 UTC (permalink / raw)
  To: Emilio Lopes; +Cc: Stefan Monnier, 18461

Emilio Lopes <eclig@gmx.net> writes:

> +    * 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'.

From the discussion, and glancing at the code, this seems like it should
have gone in, but it apparently wasn't applied.  Is this patch still
required, and does it still work?  (I'm not an svn user, so I can't
really test.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
  2016-02-23 12:08       ` Lars Ingebrigtsen
@ 2016-02-24  0:22         ` Dmitry Gutov
  2016-02-24  1:43           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2016-02-24  0:22 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Emilio Lopes; +Cc: Stefan Monnier, 18461

On 02/23/2016 02:08 PM, Lars Ingebrigtsen wrote:

> From the discussion, and glancing at the code, this seems like it should
> have gone in, but it apparently wasn't applied.  Is this patch still
> required, and does it still work?  (I'm not an svn user, so I can't
> really test.)

I _think_ this bug may have been fixed in 
83114ccf77d2a5d59fccbdbda6edefacce1b979e, in the course of fixing 
http://debbugs.gnu.org/21984.

(Either way, Emilio, please attach the patch as a file next time; I 
wasn't able to apply this one using any automated means).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved.
  2016-02-24  0:22         ` Dmitry Gutov
@ 2016-02-24  1:43           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-24  1:43 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Stefan Monnier, Emilio Lopes, 18461-done

Dmitry Gutov <dgutov@yandex.ru> writes:

> I _think_ this bug may have been fixed in
> 83114ccf77d2a5d59fccbdbda6edefacce1b979e, in the course of fixing
> http://debbugs.gnu.org/21984.

Ok; I'll close the bug.  If it's still a problem, we can reopen...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-24  1:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12 16:09 bug#18461: `vc-svn-registered' signals an error if a directory has be (re)moved Emilio Lopes
2014-09-12 17:28 ` Stefan Monnier
2014-09-12 20:36   ` Emilio Lopes
2014-09-15 13:27     ` Emilio Lopes
2016-02-23 12:08       ` Lars Ingebrigtsen
2016-02-24  0:22         ` Dmitry Gutov
2016-02-24  1:43           ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).