[PATCH 2 of 4] dirstate: don't check state of subrepo directories
Augie Fackler
durin42 at gmail.com
Thu Dec 31 23:54:43 UTC 2009
# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1262301570 21600
# Node ID 08c2b2f3b4b4aa0eb834b360cd54247542a9d997
# Parent a80612294c2e50e27852636e3fd7e0cfe832c988
dirstate: don't check state of subrepo directories
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -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, []),
}
-
diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py
--- a/hgext/inotify/__init__.py
+++ b/hgext/inotify/__init__.py
@@ -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
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -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"
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -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:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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
More information about the Mercurial-devel
mailing list