unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 37189@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#37189: 25.4.1: vc-hg-ignore implementation is missing
Date: Sun, 9 Feb 2020 00:12:40 +0100	[thread overview]
Message-ID: <3fb73dbc-bf31-233b-4afc-2147c4ffd5b7@gmx.de> (raw)
In-Reply-To: <83sgjkdev5.fsf@gnu.org>


Am 08.02.20 um 21:05 schrieb Eli Zaretskii:
>> Cc: 37189@debbugs.gnu.org
>> From: Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
>> Date: Sat, 8 Feb 2020 20:45:34 +0100
>>
>> The status quo before Emacs 27 is:
>>
>> 1. The argument FILE of `vc-ignore` is documented to accept a wildcard specification. This is the use case "pattern".
>>
>> 2. `vc-ignore` is called from `vc-dir-ignore` with either an absolute or relative filename. This is the use case "file path".
>>
>> 3. Some backends expect a file path, some backends expect a pattern. This cannot be fixed without adding a parameter to `vc-ignore`, `vc-<backend>-ignore`.
>>
>> +-----------------------+-------------+-----------+
>> | function              | file path   | pattern   |
>> +=======================+=============+===========+
>> | :func:`vc-ignore`     | strong hint | yes       |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-dir-ignore` | mandatory   | no        |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-cvs-ignore` | no          | mandatory |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-svn-ignore` | mandatory   | no        |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-src-ignore` | --          | --        |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-bzr-ignore` | no          | mandatory |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-git-ignore` | no          | mandatory |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-hg-ignore`  | no          | mandatory |
>> +-----------------------+-------------+-----------+
>> | :func:`vc-mtn-ignore` | --          | --        |
>> +-----------------------+-------------+-----------+
> This shows that (ignoring mtn for now) all of the functions support
> the "pattern" case, except vc-svn-ignore.  However, the doc string of
> vc-svn-ignore says
>
>     "Ignore FILE under Subversion.
>   FILE is a wildcard specification, either relative to
>   DIRECTORY or absolute."
>
> So it looks like it, too, supports the "pattern" use case, or what am
> I missing?

Well, FILE is used to construct a path, which is then split into file and directory parts

  (let* ((path (directory-file-name (expand-file-name file directory)))
         (directory (file-name-directory path))
         (file (file-name-nondirectory path))

The "pattern" use case is not the "wildcard" use case. "pattern" is an unspecified string, while "wildcard" is backend specific. For SVN it is a glob(7) expression without subdirectories (otherwise it does not match anything).

Besides the point, that it may not serve a true purpose, It is not possible to add a pattern containing a slash "/" to a SVN directory with `vc-svn-ignore`).

While the command:

   >>> svn propset svn:ignore 'not-here/123' '/srv/install/linux/emacs/check-svn' 

works perfectly well and stores the property as given:

   >>> svn propget svn:ignore '/srv/install/linux/emacs/check-svn'
   not-here/123

The `vc` equivalent fails:

   >>> (vc-svn-ignore 'not-here/123' '/srv/install/linux/emacs/check-svn/')
   'not-here' is not under version control
   svn: E155010: The node '/srv/install/linux/emacs/check-svn/not-here' was not found.

because the svn command issued was:

   >>> svn propset svn:ignore '123' '/srv/install/linux/emacs/check-svn/not-here'

> Now, vc-dir-ignore indeed ignores only one file, but since a file name
> is a special case of a wildcard,

No, it is not, which is the entire point ;-)

Assume you have three files named

  test5.xx
  test6.xx
  test[56].xx

Right now, when I move to the line showing "test[56].xx" and press "G", The function `vc-svn-ignore` is invoked with the FILE argument "test[56].xx", what do you expect to be ignored?

If you say anything else but "test[56].xx", we have a different opinion how the dir-mode UI should work.

Currently the result is, that the files "test5.xx" and "test6.xx" are ignored and the file "test[56].xx" still appears as "unregistered".

In order to ignore "test[56].xx", the function call:

   >>> (vc-svn-ignore "test\\[56].xx")

must be issued.

Unfortunately, critisizing use cases does not make such problems go away. Therefore, the protocol specification should be followed verbatim to implement the ignore function.

While glob syntax may actually be an esoteric use case, Hg and its regex syntax is not, since the "." is quite common in file names:

  myfile.jpg
  myfile+jpg

Ignoring "myfile.jpg" without proper escaping will also ignore "myfile+jpg". While ignoring "myfile+jpg" will not ignore anything.

So strictily speaking, yes, a file name is a special case of a wildcard, but a file name as a wildcard does not necessarily match itself.

Do you see the problem now?

>  I wonder why you say there's a need
> in an additional argument.  Can you elaborate?

The additional argument AS-IS is used to write the FILE argument unmodified to the svn:ignore poperty for DIRECTORY, so that a command:

   >>> (vc-svn-ignore 'not-here/123' '/srv/install/linux/emacs/check-svn/' t) ;; the t is the additional AS-IS argument

would succeed by issuing the appropriate shell command:

   >>> svn propset svn:ignore 'not-here/123' '/srv/install/linux/emacs/check-svn'

If you agree, that for the "file path" use case, the file path should be properly escaped, then the difference would be, e.g:

   >>> (vc-svn-ignore 'good/test[56].xx' '/srv/install/linux/emacs/check-svn/'
   svn propset svn:ignore 'test\[56].xx' '/srv/install/linux/emacs/check-svn/good'

versus:

   >>> (vc-svn-ignore 'good/test[56].xx' '/srv/install/linux/emacs/check-svn/' t) ;; the t is the additional AS-IS argument
   svn propset svn:ignore 'good/test[56].xx' '/srv/install/linux/emacs/check-svn/good'

>> I have already implemented the core handler `vc-default-ignore` replacing the defunct handlers for CVS, Git, Hg, Bzr by parameter sets. The additional parameter set for SRC is also available. I am planning on implementing Mtn. I do not plan on implementing or fixing SVN (or maybe I will).
> From my POV, it is much more important to support SVN than to support
> Monotone.  But that's me.
I already decided to adapt the algorithm/modularization to allow a simple implementation for SVN.
>> I would really like to close this thread and open one about the correct implementation of `vc-ignore`.
> Feel free to start a new thread, but I really don't see how that could
> be of any help.  In particular, this thread discusses a specific bug
> (or several related ones), and the new thread will discuss those same
> bugs, right?  Then it makes little sense to start a new thread about
> the same bug.
The title suggests that this is about Hg, while the problem affects the entire subsystem.

But I'm fine either way.

>
> Thanks.
Thank you





  reply	other threads:[~2020-02-08 23:12 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26  0:21 bug#37189: 25.4.1: vc-hg-ignore implementation is missing Wolfgang Scherer
     [not found] ` <handler.37189.B.15667808855126.ack@debbugs.gnu.org>
2019-08-26 23:25   ` bug#37189: Acknowledgement (25.4.1: vc-hg-ignore implementation is missing) Wolfgang Scherer
2019-08-27  7:45     ` Eli Zaretskii
2019-08-28  1:46       ` bug#37189: *** GMX Spamverdacht *** " Wolfgang Scherer
2019-08-28  6:16         ` Eli Zaretskii
2019-08-29  1:23           ` bug#37189: 25.4.1: vc-hg-ignore implementation is missing Wolfgang Scherer
2019-08-29  0:38         ` Wolfgang Scherer
2019-08-29 15:52           ` Wolfgang Scherer
2019-12-25  0:16             ` Dmitry Gutov
2020-01-05  3:46               ` Wolfgang Scherer
2020-01-05  8:58                 ` Andreas Schwab
2020-01-05 17:25                   ` Wolfgang Scherer
2020-01-14  1:14                 ` Dmitry Gutov
2020-02-01  1:20                   ` Wolfgang Scherer
2020-02-01  8:27                     ` Eli Zaretskii
2020-02-03  1:16                       ` Wolfgang Scherer
2020-02-04 18:55                         ` Eli Zaretskii
2020-02-05  5:18                           ` Wolfgang Scherer
2020-02-05 19:06                           ` Wolfgang Scherer
2020-02-07  9:57                             ` Eli Zaretskii
2020-02-08  9:57                               ` Dmitry Gutov
2020-02-08 19:45                                 ` Wolfgang Scherer
2020-02-08 20:05                                   ` Eli Zaretskii
2020-02-08 23:12                                     ` Wolfgang Scherer [this message]
2020-02-09 13:57                                       ` Wolfgang Scherer
2020-02-09 13:57                                       ` Wolfgang Scherer
2020-02-10 16:02                                         ` Eli Zaretskii
2020-02-11  1:45                                           ` Wolfgang Scherer
2020-02-11 17:32                                             ` Eli Zaretskii
2020-02-11 22:28                                               ` Wolfgang Scherer
2020-02-12 18:34                                                 ` Eli Zaretskii
     [not found]                                                   ` <6f3ba261-e1f9-cf19-cc22-ec8c24cf3298@gmx.de>
2020-02-12 23:20                                                     ` Wolfgang Scherer
2020-02-13  1:18                                                       ` Wolfgang Scherer
2020-02-13 15:09                                                         ` Eli Zaretskii
2020-02-13 16:30                                                           ` Wolfgang Scherer
2020-02-13 23:43                                                           ` Richard Stallman
2020-02-14  1:49                                                             ` Wolfgang Scherer
2020-02-16  2:29                                                               ` Richard Stallman
2020-02-13 15:21                                                         ` Eli Zaretskii
2020-02-13 23:40                                                           ` Dmitry Gutov
2020-02-14  9:23                                                             ` Eli Zaretskii
2020-02-21  0:05                                                               ` Dmitry Gutov
2020-02-21  8:10                                                                 ` Eli Zaretskii
2020-02-21 22:22                                                                 ` Wolfgang Scherer
2020-02-22  7:44                                                                   ` Eli Zaretskii
2020-02-22 13:46                                                                     ` Wolfgang Scherer
2020-02-22 14:30                                                                       ` Eli Zaretskii
2020-02-22 19:14                                                                         ` Dmitry Gutov
2020-02-22 22:04                                                                           ` Wolfgang Scherer
2020-02-22 23:32                                                                         ` Wolfgang Scherer
2020-02-23 15:20                                                                           ` Eli Zaretskii
2020-02-23 19:16                                                                             ` Wolfgang Scherer
2020-02-22 19:30                                                                   ` Dmitry Gutov
2020-02-22 22:00                                                                     ` Wolfgang Scherer
2020-02-22 23:58                                                                       ` Dmitry Gutov
2020-02-23  0:29                                                                         ` Wolfgang Scherer
2020-02-24 23:07                                                                           ` Dmitry Gutov
2020-02-25  2:22                                                                             ` Wolfgang Scherer
2020-03-19 23:42                                                                               ` Dmitry Gutov
2020-07-03 20:53                                                                                 ` Wolfgang Scherer
2020-07-03 21:49                                                                                   ` Dmitry Gutov
2020-02-12 17:23                                               ` Wolfgang Scherer
2020-02-09 13:57                                       ` Wolfgang Scherer
2020-02-09 14:07                                         ` Wolfgang Scherer
2020-02-08 23:59                                     ` Wolfgang Scherer
2020-02-09 21:06                               ` Wolfgang Scherer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3fb73dbc-bf31-233b-4afc-2147c4ffd5b7@gmx.de \
    --to=wolfgang.scherer@gmx.de \
    --cc=37189@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).