changeset 16645:9a21fc2c7d32

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.
author Jesse Glick <jesse.glick@oracle.com>
date Fri, 04 May 2012 15:54:55 -0400
parents 98a9266db803
children a1dcd842ce17
files mercurial/localrepo.py mercurial/match.py
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.