[Bug 6709] New: Glob expressions in subinclude
mercurial-bugs at mercurial-scm.org
mercurial-bugs at mercurial-scm.org
Sat May 28 06:44:22 UTC 2022
https://bz.mercurial-scm.org/show_bug.cgi?id=6709
Bug ID: 6709
Summary: Glob expressions in subinclude
Product: Mercurial
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: feature
Priority: wish
Component: Mercurial
Assignee: bugzilla at mercurial-scm.org
Reporter: woljiri at gmail.com
CC: mercurial-devel at mercurial-scm.org
Python Version: ---
I would like to use glob expressions in âsubinclude:â and âinclude:â lines in
.hgignore files to match multiple ignore files or include files in any
subdirectory.
Use cases
âââââââââ
Multiple ignore files
âââââââââââââââââââââ
I have several ignore files that are generated by the build system. It would be
too much error-prone to manage them manually.
Files
foo.hgignore
bar.hgignore
I would add this line to the source-root .hgignore file:
syntax: glob
include:?*.hgignore
Ignore files in subdirectories
ââââââââââââââââââââââââââââââ
The project is divided into multiple parts, each residing in one subdirectory.
To apply all the ignore files, I would add this to the main .hgignore file:
subinclude:*/.hgignore
Implementation
ââââââââââââââ
Finding files using glob-expressions that have the wildcards in directory names
can be quite expensive. I suggest also adding some kind of cache (or something)
that would make the lookup faster. If there is no cache, such glob-expressions
would slight higher performance impact on operations that use the ignore files,
but I think that it would not be big problem for most projects.
My idea about the cache: When the ignore entry list caching is enabled (in
hgrc), only one hgignore file, located in the .hg directory (let's say
.hg/cached-ignore) is used instead of other ignore files. This file contains
all the hgignore files merged, but still with globs and regular expressions
unexpanded. It is updated manually, by invoking command, let's say, hg
update-ignore. This would make the lookup much faster, but at cost of one
additional command after changing the ignore rules. Smarter approaches could be
also used, such as comparing ctimes of .hg/cached-ignore with the other ignore
files etc.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list