[PATCH 8 of 8] match: make explicitdir and traversedir None by default

Siddharth Agarwal sid0 at fb.com
Fri May 3 17:05:49 CDT 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1367617318 25200
#      Fri May 03 14:41:58 2013 -0700
# Node ID 5030e7ab87f6a0868194637530631fd76194c238
# Parent  f120b69e6479affa562116153a1e8db0ad2d23e3
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.

diff -r f120b69e6479 -r 5030e7ab87f6 hgext/inotify/client.py
--- 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 @@ class client(object):
             vdirs = cs.read(nbytes)
             if vdirs:
                 for vdir in vdirs.split('\0'):
-                    match.explicitdir(vdir)
+                    if match.explicitdir:
+                        match.explicitdir(vdir)
 
         return results
 
diff -r f120b69e6479 -r 5030e7ab87f6 mercurial/dirstate.py
--- 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 @@ class dirstate(object):
                     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 @@ class dirstate(object):
                     prefix = nf + "/"
                     for fn in dmap:
                         if fn.startswith(prefix):
-                            matchedir(nf)
+                            if matchedir:
+                                matchedir(nf)
                             skipstep3 = False
                             break
                     else:
@@ -668,7 +670,8 @@ class dirstate(object):
                 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
diff -r f120b69e6479 -r 5030e7ab87f6 mercurial/match.py
--- 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 @@ class match(object):
         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):


More information about the Mercurial-devel mailing list