problems with .bzrignore

Kent Gibson warthog618 at gmail.com
Wed May 6 05:11:22 BST 2009



John Arbash Meinel wrote:
> Tim Michelsen wrote:
> > Hello,
> > I would like to exclude the follwing files from my repository:
>
> > something.txt~
> > something.log
>
> > here is my ignore pattern:
>
> > *.~
> > *.*~
> > doc/sphinx-build.log
>
> > You can see this here:
> >
> http://bazaar.launchpad.net/%7Eweb2py/web2py/web2py-sphinx/annotate/head%3A/.bzrignore
>
>
> > Please tell me why bzr does include these file in my repository:
>
> >
> http://bazaar.launchpad.net/%7Eweb2py/web2py/web2py-sphinx/annotate/head%3A/doc/source/docs_contrib.rst%7E
>
>
> > What is wrong with my pattern?
>
>
> As near as I can tell, your pattern is fine. Just as a guess, did you
> already 'bzr add' those files? Explicitly versioning a file always takes
> precedence over an ignore rule.
>
> If that is so, you should be able to do "bzr rm --keep something.txt~".
> And then the file will switch to 'unversioned', and thus 'ignored'.
>
> John
> =:->
I agree completely with what John says above.
You might also want to remove some of the redundancy from your
.bzrignore file.
For example both these patterns

*.~
*.*~

are redundant since you already have

*~

And both these patterns

RE:^applications/(?!(admin|examples|welcome|__init__)).*$
applications/examples/static/epydoc/*

will match the same files as these rules:

applications/examples/static/epydoc/api-objects.txt
applications/examples/static/epydoc/class-tree.html
applications/examples/static/epydoc/crarr.png
applications/examples/static/epydoc/epydoc.css

The regex rule alone should be sufficient, since it is a superset of all
the others.

I'd also tend to replace rules like these:

./httpserver.log

doc/sphinx-build.log

with

*.log

unless there are many more log files you do want to version control,
than those you don't.

As well as making your .bzrignore more convoluted than it needs to be,
all your duplicate rules will slow bzr down a little, since it has more
patterns to check.  Where possible, a few generic rules are better than
a lot of specific rules.

As to how you got this problem, it looks like you've had problems with
users explicitly adding files to bzr, then trying to have them ignored
by adding rules to .bzrignore, and when that didn't work adding another...
Some of that has been cleared up by the offending file being removed
from bzr, and some, as per your docs_contrib.rst~ example are still
floating around.

Cheers,
Kent.




More information about the bazaar mailing list