localrepo: optimize internode status calls using match.always
Introduce match.always() to check if a match object always says yes, i.e.
None was passed in. If so, mfmatches should not bother iterating every file in
the repository.
--- a/mercurial/localrepo.py Fri May 11 23:11:43 2012 +0200
+++ b/mercurial/localrepo.py Fri May 04 15:54:55 2012 -0400
@@ -1333,6 +1333,8 @@
def mfmatches(ctx):
mf = ctx.manifest().copy()
+ if match.always():
+ return mf
for fn in mf.keys():
if not match(fn):
del mf[fn]
--- a/mercurial/match.py Fri May 11 23:11:43 2012 +0200
+++ b/mercurial/match.py Fri May 04 15:54:55 2012 -0400
@@ -118,6 +118,8 @@
return self._files
def anypats(self):
return self._anypats
+ def always(self):
+ return False
class exact(match):
def __init__(self, root, cwd, files):
@@ -126,6 +128,8 @@
class always(match):
def __init__(self, root, cwd):
match.__init__(self, root, cwd, [])
+ def always(self):
+ return True
class narrowmatcher(match):
"""Adapt a matcher to work on a subdirectory only.