[Pkg-bazaar-commits] ./bzr/unstable r146: match ignore patterns like ./config.h

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:51:01 UTC 2009


------------------------------------------------------------
revno: 146
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-29 18:01:30 +1000
message:
  match ignore patterns like ./config.h
modified:
  .bzrignore
  NEWS
  bzrlib/tree.py
-------------- next part --------------
=== modified file '.bzrignore'
--- a/.bzrignore	2005-03-29 07:33:29 +0000
+++ b/.bzrignore	2005-03-29 08:01:30 +0000
@@ -1,4 +1,4 @@
-doc/*.html
+./doc/*.html
 *.py[oc]
 *~
 .arch-ids

=== modified file 'NEWS'
--- a/NEWS	2005-03-29 06:25:15 +0000
+++ b/NEWS	2005-03-29 08:01:30 +0000
@@ -7,7 +7,7 @@
     * Patterns in .bzrignore are now added to the default ignore list,
       rather than replacing it.
 
-    * Ignore list is memoized after first request.
+    * Ignore list isn't reread for every file.
 
     * More help topics.
 
@@ -20,7 +20,9 @@
     * Performance improvements.
 
     * New global --profile option.
-    
+    
+    * Ignore patterns like './config.h' now correctly match files in
+      the root directory only.
 bzr-0.0.1  2005-03-26
 
   ENHANCEMENTS:

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2005-03-29 07:32:29 +0000
+++ b/bzrlib/tree.py	2005-03-29 08:01:30 +0000
@@ -308,7 +308,13 @@
         
         for pat in self.get_ignore_list():
             if '/' in pat:
-                if fnmatch.fnmatchcase(filename, pat):
+                # as a special case, you can put ./ at the start of a pattern;
+                # this is good to match in the top-level only;
+                if pat[:2] == './':
+                    newpat = pat[2:]
+                else:
+                    newpat = pat
+                if fnmatch.fnmatchcase(filename, newpat):
                     return pat
             else:
                 if fnmatch.fnmatchcase(splitpath(filename)[-1], pat):



More information about the Pkg-bazaar-commits mailing list