Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dirstate.py @ 7034:0d513661d6c2
listdir: add support for aborting if a certain path is found
This lets us bail out early if we find '.hg', letting us skip sorting
and bisecting for it.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 13 Sep 2008 10:46:47 -0500 |
parents | 7dfac37cfabf |
children | 57377fa7eda2 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Sat Sep 13 10:44:44 2008 -0500 +++ b/mercurial/dirstate.py Sat Sep 13 10:46:47 2008 -0500 @@ -9,7 +9,7 @@ from node import nullid from i18n import _ -import struct, os, bisect, stat, util, errno, ignore +import struct, os, stat, util, errno, ignore import cStringIO, osutil, sys _unknown = ('?', 0, 0, 0) @@ -458,7 +458,6 @@ normalize = self.normalize listdir = osutil.listdir lstat = os.lstat - bisect_left = bisect.bisect_left pconvert = util.pconvert getkind = stat.S_IFMT dirkind = stat.S_IFDIR @@ -510,17 +509,11 @@ nd = work.pop() if hasattr(match, 'dir'): match.dir(nd) - entries = listdir(join(nd), stat=True) if nd == '.': nd = '' + entries = listdir(join(nd), stat=True) else: - # do not recurse into a repo contained in this - # one. use bisect to find .hg directory so speed - # is good on big directory. - hg = bisect_left(entries, ('.hg')) - if hg < len(entries) and entries[hg][0] == '.hg' \ - and entries[hg][1] == dirkind: - continue + entries = listdir(join(nd), stat=True, skip ='.hg') for f, kind, st in entries: nf = normalize(nd and (nd + "/" + f) or f) if nf not in results: