[RFC] Thoughts on ignore files

Martin Pool mbp at canonical.com
Mon Sep 7 23:43:45 BST 2009

2009/9/5 Jelmer Vernooij <jelmer at samba.org>:
> At the moment ignore files in the three major distributed version
> control systems (git, mercurial, bzr) are versioned inside of the tree.
> The names and syntaxes of these files are different, so it is not
> possible to import data from one system and then have ignores work
> magically on the other.
> If you convert e.g. a mercurial branch to a bazaar branch you end up
> with a .hgignore file that Bazaar will not use. Converting this file to
> a .bzrignore file on the fly seems ideal but is not possible for a
> couple of reasons:
>  * there is no one-to-one lossless back and forth mapping (and not
> losslessly mapping would mean breaking referential integrity)
>  * what if a .bzrignore file is already present?
> Right now the working tree determines what format ignore files are
> supported. It would be nice if Bazaar could support reading and updating
> whatever ignore file is present rather than supporting just .bzrignore.
> This could for example be done through a registration mechanism.

I think that would be good: a plugin registers for the hook (or
similar) to give ignore rules, then each of those plugins are called
in turn to get the total set.

This may need a bit of care in implementation because I think the code
currently builds up one big regexp for speed, and that may be hard to
reconcile with every possible rule.  But perhaps bzr at the core could
run some chained callables, and then the default implementation can
provide a callable that evaluates that regexp.

Also 'bzr ignored' tells you why things are ignored and with the
potential complexity of this mechanism doing that sensible would be
even more important - though maybe not strictly necessary in the first

Martin <http://launchpad.net/~mbp/>

More information about the bazaar mailing list