diff mercurial/context.py @ 24326:637da5711122

manifest: have context use self.hasdir() A couple places in context currently use "x in self._dirs" to check for the existence of the directory, but this requires that all directories be loaded into a dict. Calling hasdir() instead puts the work on the the manifest to check for the existence of a directory in the most efficient manner.
author Drew Gottlieb <drgott@google.com>
date Fri, 13 Mar 2015 15:36:11 -0700
parents 79d9c51488ca
children 5da0eb641881
line wrap: on
line diff
--- a/mercurial/context.py	Fri Mar 13 15:32:45 2015 -0700
+++ b/mercurial/context.py	Fri Mar 13 15:36:11 2015 -0700
@@ -607,10 +607,8 @@
             if match(fn):
                 yield fn
         for fn in sorted(fset):
-            if fn in self._dirs:
-                # specified pattern is a directory
-                continue
-            match.bad(fn, _('no such file in rev %s') % self)
+            if not self.hasdir(fn):
+                match.bad(fn, _('no such file in rev %s') % self)
 
     def matches(self, match):
         return self.walk(match)
@@ -1564,7 +1562,7 @@
             def bad(f, msg):
                 # 'f' may be a directory pattern from 'match.files()',
                 # so 'f not in ctx1' is not enough
-                if f not in other and f not in other.dirs():
+                if f not in other and not other.hasdir(f):
                     self._repo.ui.warn('%s: %s\n' %
                                        (self._repo.dirstate.pathto(f), msg))
             match.bad = bad