[patch] syntax:plain for .hgignore

Emanuele Aina em at nerd.ocracy.org
Fri Sep 14 12:11:39 CDT 2007


Jonathan S. Shapiro prospettò:

>> Just realized, that the culprit for the bad performance in our case
>> is the '.*' that is added in front of each pattern by regex() in
>> util.py.
>> Using syntax:regexp and preceeding each fixed pattern with a '^'
>> makes things fast.
> 
> This makes a sad sort of sense, and it suggests two things that we might
> want to consider:
> 
>   1. Document this somewhere as an advisory hint.
>   2. Consider an anchor syntax for globs if we don't already have one.
> 
> Offhand, it seems to me that a glob pattern starting with / can be
> considered anchored. Failing that, we could augment the glob syntax by
> permitting a leading ^ to indicate an anchor. In either case, we should
> be sure to document the behavior someplace if that is not already done.
> 
> Other thoughts?

3. Accumulate path/glob pattern and produce a regex along the lines of
    ".*(foo|bar|baz)" from those instead of "(.*foo|.*bar|.*baz)", maybe
    it will give better results.
4. Remove path and glob syntax and leave only the regex one.

I think that the main appeal of the glob syntax is its simplicity.

Making it more elaborate will only make it a clone of the regex one with 
a different syntax.

-- 
Buongiorno.
Complimenti per l'ottima scelta.



More information about the Mercurial-devel mailing list