mercurial/util.py
changeset 13928 155d2e17884e
parent 13926 61ba09d8d118
child 13943 545091b12724
--- a/mercurial/util.py	Mon Apr 11 07:34:40 2011 -0500
+++ b/mercurial/util.py	Mon Apr 11 10:06:57 2011 +0200
@@ -555,6 +555,9 @@
         self.callback = callback
 
     def __call__(self, path):
+        '''Check the relative path.
+        path may contain a pattern (e.g. foodir/**.txt)'''
+
         if path in self.audited:
             return
         # AIX ignores "/" at end of path, others raise EISDIR.
@@ -574,7 +577,13 @@
                     base = os.path.join(*parts[:pos])
                     raise Abort(_('path %r is inside nested repo %r')
                                 % (path, base))
-        def check(prefix):
+
+        parts.pop()
+        prefixes = []
+        while parts:
+            prefix = os.sep.join(parts)
+            if prefix in self.auditeddir:
+                break
             curpath = os.path.join(self.root, prefix)
             try:
                 st = os.lstat(curpath)
@@ -592,13 +601,6 @@
                     if not self.callback or not self.callback(curpath):
                         raise Abort(_('path %r is inside nested repo %r') %
                                     (path, prefix))
-        parts.pop()
-        prefixes = []
-        while parts:
-            prefix = os.sep.join(parts)
-            if prefix in self.auditeddir:
-                break
-            check(prefix)
             prefixes.append(prefix)
             parts.pop()