changeset 10176:24ce8f0c0a39

dirstate: don't check state of subrepo directories
author Augie Fackler <durin42@gmail.com>
date Thu, 31 Dec 2009 17:19:30 -0600
parents fc32b2fc468e
children 5ca0d220ae21
files contrib/perf.py hgext/inotify/__init__.py mercurial/context.py mercurial/dirstate.py mercurial/localrepo.py
diffstat 5 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Thu Dec 31 16:30:34 2009 -0600
+++ b/contrib/perf.py	Thu Dec 31 17:19:30 2009 -0600
@@ -32,7 +32,7 @@
 def perfwalk(ui, repo, *pats):
     try:
         m = cmdutil.match(repo, pats, {})
-        timer(lambda: len(list(repo.dirstate.walk(m, True, False))))
+        timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
     except:
         try:
             m = cmdutil.match(repo, pats, {})
@@ -150,4 +150,3 @@
     'perftemplating': (perftemplating, []),
     'perfdiffwd': (perfdiffwd, []),
 }
-
--- a/hgext/inotify/__init__.py	Thu Dec 31 16:30:34 2009 -0600
+++ b/hgext/inotify/__init__.py	Thu Dec 31 17:19:30 2009 -0600
@@ -42,11 +42,11 @@
         # to start an inotify server if it won't start.
         _inotifyon = True
 
-        def status(self, match, ignored, clean, unknown=True):
+        def status(self, match, subrepos, ignored, clean, unknown=True):
             files = match.files()
             if '.' in files:
                 files = []
-            if self._inotifyon and not ignored and not self._dirty:
+            if self._inotifyon and not ignored and not subrepos and not self._dirty:
                 cli = client(ui, repo)
                 try:
                     result = cli.statusquery(files, match, False,
@@ -70,7 +70,7 @@
                         result = r2
                     return result
             return super(inotifydirstate, self).status(
-                match, ignored, clean, unknown)
+                match, subrepos, ignored, clean, unknown)
 
     repo.dirstate.__class__ = inotifydirstate
 
--- a/mercurial/context.py	Thu Dec 31 16:30:34 2009 -0600
+++ b/mercurial/context.py	Thu Dec 31 17:19:30 2009 -0600
@@ -638,7 +638,8 @@
         return self._parents[0].ancestor(c2) # punt on two parents for now
 
     def walk(self, match):
-        return sorted(self._repo.dirstate.walk(match, True, False))
+        return sorted(self._repo.dirstate.walk(match, self.substate.keys(),
+                                               True, False))
 
     def dirty(self, missing=False):
         "check whether a working directory is modified"
--- a/mercurial/dirstate.py	Thu Dec 31 16:30:34 2009 -0600
+++ b/mercurial/dirstate.py	Thu Dec 31 17:19:30 2009 -0600
@@ -425,7 +425,7 @@
                 return True
         return False
 
-    def walk(self, match, unknown, ignored):
+    def walk(self, match, subrepos, unknown, ignored):
         '''
         Walk recursively through the directory tree, finding all files
         matched by match.
@@ -486,7 +486,8 @@
         files = set(match.files())
         if not files or '.' in files:
             files = ['']
-        results = {'.hg': None}
+        results = dict.fromkeys(subrepos)
+        results['.hg'] = None
 
         # step 1: find all explicit files
         for ff in sorted(files):
@@ -564,11 +565,12 @@
                 if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):
                     st = None
                 results[nf] = st
-
+        for s in subrepos:
+            del results[s]
         del results['.hg']
         return results
 
-    def status(self, match, ignored, clean, unknown):
+    def status(self, match, subrepos, ignored, clean, unknown):
         '''Determine the status of the working copy relative to the
         dirstate and return a tuple of lists (unsure, modified, added,
         removed, deleted, unknown, ignored, clean), where:
@@ -609,7 +611,8 @@
         dadd = deleted.append
         cadd = clean.append
 
-        for fn, st in self.walk(match, listunknown, listignored).iteritems():
+        for fn, st in self.walk(match, subrepos, listunknown,
+                                listignored).iteritems():
             if fn not in dmap:
                 if (listignored or match.exact(fn)) and self._dirignore(fn):
                     if listignored:
--- a/mercurial/localrepo.py	Thu Dec 31 16:30:34 2009 -0600
+++ b/mercurial/localrepo.py	Thu Dec 31 17:19:30 2009 -0600
@@ -1000,7 +1000,9 @@
             match.bad = bad
 
         if working: # we need to scan the working dir
-            s = self.dirstate.status(match, listignored, listclean, listunknown)
+            subrepos = ctx1.substate.keys()
+            s = self.dirstate.status(match, subrepos, listignored,
+                                     listclean, listunknown)
             cmp, modified, added, removed, deleted, unknown, ignored, clean = s
 
             # check for any possibly clean files