unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18619: 24.3.93; vc-svn-ignore is broken
@ 2014-10-03  2:02 Dmitry Gutov
  2014-10-03  2:46 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2014-10-03  2:02 UTC (permalink / raw)
  To: 18619

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 juri@jurta.org-20140918205955-kwp5ckzrk2l4w1km
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').






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

* bug#18619: 24.3.93; vc-svn-ignore is broken
  2014-10-03  2:02 bug#18619: 24.3.93; vc-svn-ignore is broken Dmitry Gutov
@ 2014-10-03  2:46 ` Stefan Monnier
  2014-10-03  3:55   ` Dmitry Gutov
  2014-10-03  4:08   ` Dmitry Gutov
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-10-03  2:46 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 18619

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

The vc-svn.el change is fine for emacs-24 since the existing code is indeed
hopelessly broken (so it won't be worse in any case).
But could you explain why you think the vc.el change is safe (I can agree
it makes sense, but I want to be extra sure the change is safe).


        Stefan





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

* bug#18619: 24.3.93; vc-svn-ignore is broken
  2014-10-03  2:46 ` Stefan Monnier
@ 2014-10-03  3:55   ` Dmitry Gutov
  2014-10-03  4:08   ` Dmitry Gutov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2014-10-03  3:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18619

On 10/03/2014 06:46 AM, Stefan Monnier wrote:

> But could you explain why you think the vc.el change is safe (I can agree
> it makes sense, but I want to be extra sure the change is safe).

Actually, I'm not sure that it's safe. Looking at `vc-default-ignore', 
it seems we're expected to obtain the relative path in the backend 
implementation functions.

This works, too, and limits the changes to `vc-svn.el'.





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

* bug#18619: 24.3.93; vc-svn-ignore is broken
  2014-10-03  2:46 ` Stefan Monnier
  2014-10-03  3:55   ` Dmitry Gutov
@ 2014-10-03  4:08   ` Dmitry Gutov
  2014-10-03 12:24     ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2014-10-03  4:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18619

The new patch:

=== 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 03:41:39 +0000
@@ -354,14 +354,23 @@
  		(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))
+         (file (file-relative-name file 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."






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

* bug#18619: 24.3.93; vc-svn-ignore is broken
  2014-10-03  4:08   ` Dmitry Gutov
@ 2014-10-03 12:24     ` Stefan Monnier
  2014-10-03 13:25       ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-10-03 12:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 18619

> The new patch:

Please install it into emacs-24, thank you,


        Stefan





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

* bug#18619: 24.3.93; vc-svn-ignore is broken
  2014-10-03 12:24     ` Stefan Monnier
@ 2014-10-03 13:25       ` Dmitry Gutov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2014-10-03 13:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18619-done

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

Done, thanks.





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

end of thread, other threads:[~2014-10-03 13:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03  2:02 bug#18619: 24.3.93; vc-svn-ignore is broken Dmitry Gutov
2014-10-03  2:46 ` Stefan Monnier
2014-10-03  3:55   ` Dmitry Gutov
2014-10-03  4:08   ` Dmitry Gutov
2014-10-03 12:24     ` Stefan Monnier
2014-10-03 13:25       ` Dmitry Gutov

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