[Pkg-bazaar-commits] ./bzr/unstable r102: - cache ignore list in Tree
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:51:11 UTC 2009
------------------------------------------------------------
revno: 102
committer: mbp at sourcefrog.net
timestamp: Sun 2005-03-27 19:50:34 +1000
message:
- cache ignore list in Tree
- bzrignore adds to default patterns
modified:
NEWS
bzrlib/tree.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2005-03-27 09:14:45 +0000
+++ b/NEWS 2005-03-27 09:50:34 +0000
@@ -5,6 +5,13 @@
* Default ignore list changed to .bzr.log, *~, #*#, *.tmp, *.bak,
*.o, *.a, *.py[oc], {arch}, CVS, .svn, _darcs.
+ * Patterns in .bzrignore are now added to the default ignore list,
+ rather than replacing it.
+
+ ENHANCEMENTS:
+
+ * Ignore list is memoized after first request.
+
bzr-0.0.1 2005-03-26
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2005-03-23 03:09:50 +0000
+++ b/bzrlib/tree.py 2005-03-27 09:50:34 +0000
@@ -262,12 +262,19 @@
def get_ignore_list(self):
- """Return list of ignore patterns."""
+ """Return list of ignore patterns.
+
+ Cached in the Tree object after the first call.
+ """
+ if hasattr(self, '_ignorelist'):
+ return self._ignorelist
+
+ l = bzrlib.DEFAULT_IGNORE[:]
if self.has_filename(bzrlib.IGNORE_FILENAME):
f = self.get_file_byname(bzrlib.IGNORE_FILENAME)
- return [line.rstrip("\n\r") for line in f.readlines()]
- else:
- return bzrlib.DEFAULT_IGNORE
+ l.extend([line.rstrip("\n\r") for line in f.readlines()])
+ self._ignorelist = l
+ return l
def is_ignored(self, filename):
@@ -275,7 +282,6 @@
Patterns containing '/' need to match the whole path; others
match against only the last component."""
- ## TODO: Take them from a file, not hardcoded
## TODO: Use extended zsh-style globs maybe?
## TODO: Use '**' to match directories?
for pat in self.get_ignore_list():
More information about the Pkg-bazaar-commits
mailing list