[Pkg-bazaar-commits] ./bzr/unstable r132: Tree.is_ignored returns the pattern that matched, if any

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:44:11 UTC 2009


------------------------------------------------------------
revno: 132
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-29 12:41:07 +1000
message:
  Tree.is_ignored returns the pattern that matched, if any
modified:
  bzrlib/tree.py
-------------- next part --------------
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2005-03-29 02:31:34 +0000
+++ b/bzrlib/tree.py	2005-03-29 02:41:07 +0000
@@ -280,17 +280,22 @@
         """Check whether the filename matches an ignore pattern.
 
         Patterns containing '/' need to match the whole path; others
-        match against only the last component."""
-        ## TODO: Use extended zsh-style globs maybe?
-        ## TODO: Use '**' to match directories?
+        match against only the last component.
+
+        If the file is ignored, returns the pattern which caused it to
+        be ignored, otherwise None.  So this can simply be used as a
+        boolean if desired."""
+
+        ## TODO: Use '**' to match directories, and other extended globbing stuff from cvs/rsync.
+        
         for pat in self.get_ignore_list():
             if '/' in pat:
                 if fnmatch.fnmatchcase(filename, pat):
-                    return True
+                    return pat
             else:
                 if fnmatch.fnmatchcase(splitpath(filename)[-1], pat):
-                    return True
-        return False
+                    return pat
+        return None
         
 
         



More information about the Pkg-bazaar-commits mailing list