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

John A Meinel john at arbash-meinel.com
Sat Jan 14 20:17:42 GMT 2006


Martin Pool wrote:
> 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.
> 

I realize that inside a shell, *foo doesn't match '.foo', are you
specifically requesting that behavior from the bzr ignore pattern? It
doesn't really seem useful to me.
In general, you want hidden (. prefixed) files to be ignored. So by
ignoring them with the ignore pattern, you are actually making them more
obvious, not less (double negative => positive sort of thing)

As far as being bound to a transaction...
How far do we want transaction to extend into everything? Right now, it
is a little bit ugly to pass it around everywhere (partially because
'transaction' is such a long word).
'session' might be a lot more palatable, and closer to what we actually
mean by the class. (We can't rollback a Transaction, so it isn't really
a transaction as such).

Also, right now, we only really use the PassThroughTransaction, which
doesn't do anything, and bzr only runs long enough to do everything 1
time anyway. A future GUI/server would probably care more that things
are cleaned up after every operation, since bzrlib would stay resident
in ram for longer. So I'm not saying we don't want to use it, I'm just
trying to figure out if it is worth doing that right now.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060114/41e0e29a/attachment.pgp 


More information about the bazaar mailing list