GNU bug report logs - #37189
25.4.1: vc-hg-ignore implementation is missing

Previous Next

Package: emacs;

Reported by: Wolfgang Scherer <Wolfgang.Scherer <at> gmx.de>

Date: Mon, 26 Aug 2019 00:55:02 UTC

Severity: normal

Found in version 25.4.1

Full log


View this message in rfc822 format

From: Wolfgang Scherer <Wolfgang.Scherer <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37189 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#37189: 25.4.1: vc-hg-ignore implementation is missing
Date: Sun, 9 Feb 2020 00:12:40 +0100
Am 08.02.20 um 21:05 schrieb Eli Zaretskii:
>> Cc: 37189 <at> debbugs.gnu.org
>> From: Wolfgang Scherer <Wolfgang.Scherer <at> 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




This bug report was last modified 4 years and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.