changeset 19143:3cb9468535bd

match: make explicitdir and traversedir None by default With this, extensions can easily tell when traversedir and/or explicitdir don't need to be called.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 03 May 2013 14:41:58 -0700
parents c3d3e4d75ec3
children facd906caeeb
files hgext/inotify/client.py mercurial/dirstate.py mercurial/match.py
diffstat 3 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/client.py	Fri May 03 14:39:28 2013 -0700
+++ b/hgext/inotify/client.py	Fri May 03 14:41:58 2013 -0700
@@ -159,7 +159,8 @@
             vdirs = cs.read(nbytes)
             if vdirs:
                 for vdir in vdirs.split('\0'):
-                    match.explicitdir(vdir)
+                    if match.explicitdir:
+                        match.explicitdir(vdir)
 
         return results
 
--- a/mercurial/dirstate.py	Fri May 03 14:39:28 2013 -0700
+++ b/mercurial/dirstate.py	Fri May 03 14:41:58 2013 -0700
@@ -623,7 +623,8 @@
                     if nf in dmap:
                         #file deleted on disk but still in dirstate
                         results[nf] = None
-                    matchedir(nf)
+                    if matchedir:
+                        matchedir(nf)
                     if not dirignore(nf):
                         wadd(nf)
                 elif kind == regkind or kind == lnkkind:
@@ -639,7 +640,8 @@
                     prefix = nf + "/"
                     for fn in dmap:
                         if fn.startswith(prefix):
-                            matchedir(nf)
+                            if matchedir:
+                                matchedir(nf)
                             skipstep3 = False
                             break
                     else:
@@ -668,7 +670,8 @@
                 if nf not in results:
                     if kind == dirkind:
                         if not ignore(nf):
-                            matchtdir(nf)
+                            if matchtdir:
+                                matchtdir(nf)
                             wadd(nf)
                         if nf in dmap and (matchalways or matchfn(nf)):
                             results[nf] = None
--- a/mercurial/match.py	Fri May 03 14:39:28 2013 -0700
+++ b/mercurial/match.py	Fri May 03 14:41:58 2013 -0700
@@ -119,10 +119,8 @@
         found/accessed, with an error message
         '''
         pass
-    def explicitdir(self, f):
-        pass
-    def traversedir(self, f):
-        pass
+    explicitdir = None
+    traversedir = None
     def missing(self, f):
         pass
     def exact(self, f):