[patch] syntax:plain for .hgignore

Johannes Hofmann Johannes.Hofmann at gmx.de
Tue Sep 11 08:56:57 CDT 2007


On Mon, Sep 10, 2007 at 05:28:19PM -0400, Jonathan S. Shapiro wrote:
> On Mon, 2007-09-10 at 22:58 +0200, Johannes Hofmann wrote:
> 
> > Hm, checking for these characters sounds quite ugly and error prone.
> > Especially the handling of escaped characters.
> 
> Take the easy way out: If '*', '?', '[', or ']' is present, assume it's
> a regexp. That is a conservative approach.
> 
> > It may well be the compilation time of the huge regexpression that
> > is built from the 500 line .hgignore.
> > A quick test with an empty repository that just contains a 500 line
> > .hgignore file shows:
> > 
> > hofmann at blob:/tmp/hgignoretest >time hg st
> > ? .hgignore
> > 
> > real    0m1.030s
> > user    0m0.984s
> > sys     0m0.023s
> > 
> > But I will check again on our real world example tomorrow.
> > 
> > Would it be possible to cache the compiled regexpression somewhere?
> 
> In principle yes. I do not know if python provides serialization for
> compiled regexps. If it does, the compiled form could be serialized
> to .hg/hgignore-cache along with a file modification time stamp, and
> re-computed only when the .hgignore is actually modified.

Just tried that using "pickle". Unfortunately there was no
performance gain. Not really surprising after looking at the
serialized compiled regexpression. It is more or less the
regexpression string that needs to be compiled again during
desrialization :-(

> 
> shap
> -- 
> Jonathan S. Shapiro
> Managing Director
> The EROS Group, LLC
> www.coyotos.org, www.eros-os.org


More information about the Mercurial-devel mailing list