[PATCH 1 of 2] convert: Support glob exclude patterns

Tessa Starkey testarkey at gmail.com
Wed Feb 3 18:49:00 CST 2010


On Wed, Feb 3, 2010 at 4:01 AM, Martin Geisler <mg at lazybytes.net> wrote:

> Tessa Starkey <testarkey at gmail.com> writes:
>
> > Thanks for the comments. Responses inline.
> >
> > On Tue, Feb 2, 2010 at 6:20 PM, Greg Ward <greg-hg at gerg.ca> wrote:
> >
> >> On Tue, Feb 2, 2010 at 2:07 PM, Tessa Starkey <testarkey at gmail.com>
> wrote:
> >> > # HG changeset patch
> >> > # User Tessa Starkey <testarkey at gmail.com>
> >> > # Date 1265132627 18000
> >> > # Node ID 052ab4a8d877c59c398a7ed2f52644387dc56d9b
> >> > # Parent  d9aa5b368e36c10d2c29411772fef9fd339c2e9f
> >> > convert: Support glob exclude patterns
> >>
> >> That sounds useful.
> >>
> >> > --- a/hgext/convert/__init__.py
> >> > +++ b/hgext/convert/__init__.py
> >> > @@ -84,15 +84,19 @@
> >> >
> >> >       exclude path/to/file
> >> >
> >> > +      glob_exclude path/to/file
> >> > +
> >>
> >> Why does this require a new command?  Is there something wrong with
> >> supporting globs in the existing 'exclude' command?
> >>
> >     The reason that glob_exclude is a separate command is to
> > distinguish between entries that use the characters '*' and '?' as
> > wildcards and file names that actually contain these characters. On
> > the off chance that someone actually names a file '*.py', they can
> > exclude that file without exlcuding all .py files.
>
> I also dislike all these mini-languages that have weird limitations.
>
> Like Matt, I suggest we use our standard functions from the match module
> to handle these patterns and that we stick with a single 'exclude'
> keyword.




I investigated using the main matching module and I ran into the problem
that match takes a repository as a parameter and the filemapper (the object
that decides whether a file is include or exclude) doesn't know anything
about the reposititory or its files.  To use main match module, I would have
to add to the filemapper a reference to the repository or is root directory.
I think this is doable, but   I think it would be best to avoid ripping up
too much of the original  convert extension when implementing this small
feature.



> This mechanism already support escaping:
>
>  % hg init
>  % touch a.txt \?.txt
>  % hg status
>  ? ?.txt
>  ? a.txt
>  % hg status -X '?.txt'
>  % hg status -X '\?.txt'
>  ? a.txt
>
> --
> Martin Geisler
>
> VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
> SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100203/17e7fbcf/attachment.htm>


More information about the Mercurial-devel mailing list