[PATCH] Proposed patch: support for Python functions as .hgignore filters

Greg Ward greg-hg at gerg.ca
Tue Jun 29 09:07:38 CDT 2010


On Mon, Jun 28, 2010 at 4:50 PM, Steve Borho <steve at borho.org> wrote:
>>> Boris Figovsky wrote, On 06/28/2010 10:07 PM:
>>> > Hello,
>>> > In a project I work on, our build system generated a lot of files in
>>> > the working directory,
>>> > and we wanted Mercurial to ignore them, but the current .hgignore
>>> > syntax is not enough.
>>> > We thought we could use Python functions, such as os.path.islink or
>>> > mymodule.py's is_ignored() func.
>>> > The outcome is the attached patch.
[...]
> Could this be an 'opt-in' feature added by an extension?

In fact, I wrote an extension like this that hardcodes our custom
ignore rules.  The classic in our case is: if a filename endswith
".java" or ".properties" AND it is a symlink AND readlink() startswith
"../", then ignore it.  I'll attach the extension for posterity.  The
code is fairly self-explanatory.

Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ignore.py
Type: text/x-python
Size: 4213 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100629/468519da/attachment.py>


More information about the Mercurial-devel mailing list