[patch] syntax:plain for .hgignore

Johannes Hofmann Johannes.Hofmann at gmx.de
Mon Sep 10 14:32:00 CDT 2007


Hello Jonathan,

> Jonathan S. Shapiro wrote:
> Here is a completely different opinion: the right fix is to drop
> syntax:plain entirely.
> 
> The .hgignore file seems to be a place where far too many options
> are getting injected. This will rapidly become unmaintainable, and the
> whole thing will collapse of its own weight. Frankly, the "regexp or glob"
> distinction is already too much for most users.

Good point.

> 
> Here is the question that we should be asking: is the benefit of
> plain syntax buying us enough advantage to justify the confusion that it
> creates?
> 
>   path:path/to/dir
> 
> can be expressed already by:
> 
>   syntax: glob
>   /path/to/dir/**
> 
> while plain:path/to/file
> 
> can be expressed already by:
> 
>   syntax: glob
>   /path/to/file
> 
> So what benefit are we getting from path/plain? The only benefit I
> can see here is if bos gets paid for his book by the word :-)

I started the syntax:plain stuff not to add new functionality, but
to improve performance in a special case where .hgignore is about
500 lines and mostly contains plain strings (no regexp or glob
matching needed). Looking up strings in a list is much faster
than regexp matching.

However I agree that the performance optimization should better be
done behind the scenes without adding new syntax options for
.hgignore. Does anyone know an easy/robust way to check whether a
string contains special regexp syntax or not?

 Johannes

> 
> 
> (in both cases I intend an anchored glob -- I'm not sure that I got
> the syntax correct).
> 
> -- 
> Jonathan S. Shapiro
> Managing Director
> The EROS Group, LLC
> www.coyotos.org, www.eros-os.org


More information about the Mercurial-devel mailing list