Subject: bug#18619: closed (Re: bug#18619: 24.3.93; vc-svn-ignore is broken)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 03 Oct 2014 13:26:03 +0000

Your bug report

#18619: 24.3.93; vc-svn-ignore is broken

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
18619: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18619
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#18619: 24.3.93; vc-svn-ignore is broken
From: Dmitry Gutov <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Fri, 03 Oct 2014 17:25:22 +0400
List-Id: <debbugs-submit.debbugs.gnu.org>

On 10/03/2014 04:24 PM, Stefan Monnier wrote:
> Please install it into emacs-24, thank you,

Done, thanks.

Subject: 24.3.93; vc-svn-ignore is broken
From: Dmitry Gutov <[email-masked]>
To: [email-masked]
Date: Fri, 03 Oct 2014 06:02:55 +0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

It plainly doesn't work: gives an error when called on an unregistered
file, or (maybe, haven't tested) succeeds and does nothing when called
on a registered file.

The way it's currently written is wrong. I don't think there's a way to
do "add this file to ignores" in one command invocation. SVN has
"propget" and "propset" commands, the value has to be a list of
wildcards to ignore, one per line, and it needs to be set on a parent
directory, not on the file itself, like the current code tries to do.

The attached patch mostly takes care of this. The change to `vc-ignore'
is needed because this property doesn't work with absolute paths. And
passing a relative path to backend `ignore' implementations make sense
anyway.

In GNU Emacs 24.3.93.4 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-09-19 on axl
Repository revision: 117510 [email-masked]
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04.1 LTS

=== 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-10-03 01:51:12 +0000
@@ -354,14 +354,22 @@
 		(concat "-r" rev))
 	   (vc-switches 'SVN 'checkout))))
 
-(defun vc-svn-ignore (file &optional _directory _remove)
+(defun vc-svn-ignore (file &optional directory remove)
   "Ignore FILE under Subversion.
 FILE is a file wildcard, relative to the root directory of DIRECTORY."
-  (vc-svn-command t 0 file "propedit" "svn:ignore"))
+  (let* ((ignores (vc-svn-ignore-completion-table directory))
+         (ignores (if remove
+                      (delete file ignores)
+                    (push file ignores))))
+    (vc-svn-command nil 0 nil nil "propset" "svn:ignore"
+                    (mapconcat #'identity ignores "\n")
+                    (expand-file-name directory))))
 
-(defun vc-svn-ignore-completion-table (_file)
-  "Return the list of ignored files."
-  )
+(defun vc-svn-ignore-completion-table (directory)
+  "Return the list of ignored files in DIRECTORY."
+  (with-temp-buffer
+    (vc-svn-command t t nil "propget" "svn:ignore" (expand-file-name directory))
+    (split-string (buffer-string))))
 
 (defun vc-svn-find-admin-dir (file)
   "Return the administrative directory of FILE."

=== modified file 'lisp/vc/vc.el'
--- lisp/vc/vc.el	2014-01-01 07:43:34 +0000
+++ lisp/vc/vc.el	2014-10-03 01:58:18 +0000
@@ -1370,7 +1370,9 @@
   (let* ((directory (or directory default-directory))
 	 (backend (or (vc-responsible-backend default-directory)
                       (error "Unknown backend"))))
-    (vc-call-backend backend 'ignore file directory remove)))
+    (vc-call-backend backend 'ignore
+                     (file-relative-name file directory)
+                     directory remove)))
 
 (defun vc-default-ignore (backend file &optional directory remove)
   "Ignore FILE under the VCS of DIRECTORY (default is `default-directory').