match: support rooted globs in hgignore
In a .hgignore, "glob:foo" always means "/foo". This cannot be
avoided because there is no syntax like "^" in regexes to say you
don't want the implied "/" (of course one can use regexes, but glob
syntax is nice).
When you have a long list of fairly specific globs like
path/to/some/thing, this has two consequences:
- unintended files may be ignored (not too common though)
- matching performance can suffer significantly Here is vanilla hg status timing on a private repository:
Using syntax:glob everywhere real 0m2.199s user 0m1.545s sys 0m0.619s
When rooting the appropriate globs real 0m1.434s user 0m0.847s sys 0m0.565s
(tangentially, none of this shows up in --profile's output. It seems that C code doesn't play well with profiling)
The code already supports this but there is no syntax to make use of
it, so it seems reasonable to create such syntax. I create a new
hgignore syntax "rootglob".
Differential Revision: https://phab.mercurial-scm.org/D5493