changeset 24406:1297480ed347

treemanifest: make hasdir() faster Same rationale as the previous change.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 16 Mar 2015 16:01:16 -0700
parents cbe9d50d9e65
children caa6b6c65dc3
files mercurial/manifest.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Tue Mar 03 13:50:06 2015 -0800
+++ b/mercurial/manifest.py	Mon Mar 16 16:01:16 2015 -0700
@@ -506,7 +506,12 @@
         return self._alldirs
 
     def hasdir(self, dir):
-        return dir in self._alldirs
+        topdir, subdir = _splittopdir(dir)
+        if topdir:
+            if topdir in self._dirs:
+                return self._dirs[topdir].hasdir(subdir)
+            return False
+        return (dir + '/') in self._dirs
 
     def matches(self, match):
         '''generate a new manifest filtered by the match argument'''