mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
sparse: implement negatematcher.visitdir
Summary: `negatematcher.visitdir` was using the default implementation - `return True`. It's correct but not helpful to skip visiting a large directory. Make it return more efficient results if possible. Reviewed By: DurhamG Differential Revision: D10352848 fbshipit-source-id: 05b19342192a54e114d02564058435fb3ac34590
This commit is contained in:
parent
84d4d887bc
commit
c990d8cd4f
@ -2506,6 +2506,15 @@ class negatematcher(matchmod.basematcher):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<negatematcher matcher=%r>" % self._matcher
|
return "<negatematcher matcher=%r>" % self._matcher
|
||||||
|
|
||||||
|
def visitdir(self, dir):
|
||||||
|
orig = self._matcher.visitdir(dir)
|
||||||
|
if orig == "all":
|
||||||
|
return False
|
||||||
|
elif orig is False:
|
||||||
|
return "all"
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def hash(self):
|
def hash(self):
|
||||||
sha1 = hashlib.sha1()
|
sha1 = hashlib.sha1()
|
||||||
sha1.update("negate")
|
sha1.update("negate")
|
||||||
|
Loading…
Reference in New Issue
Block a user