[PATCH][MERGE] Improvements to is_ignored, take 2
Martin Pool
mbp at sourcefrog.net
Fri Jan 13 01:43:13 GMT 2006
On 12 Jan 2006, Jan Hudec <bulb at ucw.cz> wrote:
> Hello,
>
> 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.
> + 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.
--
Martin
-------------- 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/fdedb46a/attachment.pgp
More information about the bazaar
mailing list