Patchwork [1,of,8] match: introduce explicitdir and traversedir

login
register
mail settings
Submitter Siddharth Agarwal
Date May 3, 2013, 10:05 p.m.
Message ID <1e79492d1382f551d989.1367618742@sid0x220>
Download mbox | patch
Permalink /patch/1548/
State Accepted
Commit e073ac988b513d013b7c3c8d2dcff54f17263e5d
Headers show

Comments

Siddharth Agarwal - May 3, 2013, 10:05 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1367209449 25200
#      Sun Apr 28 21:24:09 2013 -0700
# Node ID 1e79492d1382f551d9890f97f5b58f1101bfc004
# Parent  b5afc296b77bcbb8122c9316f727cb35e7d5dd02
match: introduce explicitdir and traversedir

match.dir is currently called in two different places:
(1) noting when a directory specified explicitly is visited.
(2) noting when a directory is visited during a recursive walk.

purge cares about both, but commit only cares about the first.

Upcoming patches will split the two cases into two different callbacks. Why
bother? Consider a hypothetical extension that can provide more efficient walk
results, via e.g. watching the filesystem. That extension will need to
fall back to a full recursive walk if a callback is set for (2), but not if a
callback is only set for (1).
Matt Mackall - May 3, 2013, 10:13 p.m.
On Fri, 2013-05-03 at 15:05 -0700, Siddharth Agarwal wrote:
> +    def explicitdir(self, f):
> +        self.dir(f)
> +    def traversedir(self, f):
> +        self.dir(f)

Follow-up with some docstrings, please.

Patch

diff -r b5afc296b77b -r 1e79492d1382 mercurial/match.py
--- a/mercurial/match.py	Tue Oct 02 15:32:21 2012 -0700
+++ b/mercurial/match.py	Sun Apr 28 21:24:09 2013 -0700
@@ -121,6 +121,10 @@  class match(object):
         pass
     def dir(self, f):
         pass
+    def explicitdir(self, f):
+        self.dir(f)
+    def traversedir(self, f):
+        self.dir(f)
     def missing(self, f):
         pass
     def exact(self, f):