[PATCH][MERGE] Improvements to is_ignored, take 2

Jan Hudec bulb at ucw.cz
Fri Jan 13 06:22:04 GMT 2006


On Fri, Jan 13, 2006 at 12:43:13 +1100, Martin Pool wrote:
> On 12 Jan 2006, Jan Hudec <bulb at ucw.cz> wrote:
> > I have improved on the is_ignored enhancements. The is_ignored_by method
> > should now work even when there are more than 100 patterns. No test cases
> > added to check that yet though.
> 
> This looks good, but I would definitely want some tests that it does the
> right thing -- perhaps at the level of transforming some known globs to
> regexps and checking you get what you want.  You might also check that
> the ignore pattern tests cover areas likely to be dangerous in
> translation to REs, such as handling of dot.
> 
> fnmatch as I recall doesn't implement the correct unix behaviour of
> '*foo' not matching '.foo'.  So it'd be good to add a test that this is
> now fixed.

No, /this/ is /not/ fixed yet -- it still uses fnmatch. The cleanup so far is
only to make is_ignored faster by combining all the patterns to one.

> > +    def _get_ignore_regex(self):
> > +        """Return a regular expression composed of ignore patterns.
> > +
> > +        Cached in the Tree object after the first call.
> > +        """
> > +        import re
> > +        if not hasattr(self, '_ignoreregex'):
> > +            self._ignoreregex = re.compile(
> > +                    _glob_list_to_regex(self.get_ignore_list()))
> > +        return self._ignoreregex
> 
> Is this cache flushed if the ignore file changes?  It seems like either
> that should happen, or perhaps the cache should be tied to the
> Transaction.

Hm, I have done exactly what get_ignore_list does -- and copied the comment
over as well. So it might be yet another thing to fix.

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060113/f2c648be/attachment.pgp 


More information about the bazaar mailing list