Mercurial > hg-stable
changeset 7494:85dc88630beb
util: disable walkrepo() recursive behaviour
Revert b1aea76f700 and 268c582bd42a for performances reasons. Traversing
checkout working directories may be too expensive.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 10 Dec 2008 00:16:12 +0100 |
parents | 6644c111f9e9 |
children | 90487273f59c 0a27d0db256d |
files | mercurial/util.py tests/test-hgwebdir tests/test-hgwebdir.out tests/test-walkrepo.py |
diffstat | 4 files changed, 6 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Sat Dec 06 20:10:31 2008 +0100 +++ b/mercurial/util.py Wed Dec 10 00:16:12 2008 +0100 @@ -1901,7 +1901,7 @@ _add_dir_if_not_there(seen_dirs, path) for root, dirs, files in os.walk(path, topdown=True, onerror=errhandler): if '.hg' in dirs: - dirs.remove('.hg') # don't recurse inside the .hg directory + dirs[:] = [] # don't descend further yield root # found a repository qroot = os.path.join(root, '.hg', 'patches') if os.path.isdir(os.path.join(qroot, '.hg')):
--- a/tests/test-hgwebdir Sat Dec 06 20:10:31 2008 +0100 +++ b/tests/test-hgwebdir Wed Dec 10 00:16:12 2008 +0100 @@ -16,14 +16,8 @@ hg init c echo c > c/c hg --cwd c ci -Amc -d'3 0' +root=`pwd` -cd b -hg init d -echo d > d/d -hg --cwd d ci -Amd -cd .. - -root=`pwd` cd .. cat > paths.conf <<EOF @@ -85,7 +79,6 @@ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw' "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw' "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw' -"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/d/rev/tip/?style=raw' echo % paths errors 1 cat error-paths-1.log
--- a/tests/test-hgwebdir.out Sat Dec 06 20:10:31 2008 +0100 +++ b/tests/test-hgwebdir.out Wed Dec 10 00:16:12 2008 +0100 @@ -1,7 +1,6 @@ adding a adding b adding c -adding d % should give a 404 - file does not exist 404 Not Found @@ -32,7 +31,6 @@ /b/ /coll/a/ /coll/b/ -/coll/b/d/ /coll/c/ /t/a/ @@ -112,7 +110,6 @@ /coll/a/ /coll/b/ -/coll/b/d/ /coll/c/ 200 Script output follows @@ -124,7 +121,6 @@ /a/ /b/ -/b/d/ /c/ 200 Script output follows @@ -136,21 +132,6 @@ 200 Script output follows c -200 Script output follows - - -# HG changeset patch -# User test -# Date 0 0 -# Node ID 43cb50608b2ae8635a62e2e8730adefc32a274ee - -d - ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/d Thu Jan 01 00:00:00 1970 +0000 -@@ -0,0 +1,1 @@ -+d - % paths errors 1 % paths errors 2 % collections errors
--- a/tests/test-walkrepo.py Sat Dec 06 20:10:31 2008 +0100 +++ b/tests/test-walkrepo.py Wed Dec 10 00:16:12 2008 +0100 @@ -12,12 +12,6 @@ mkdir('subdir') chdir('subdir') hg.repository(u, 'sub1', create=1) -chdir('sub1') -hg.repository(u, 'inside_sub1', create=1) -chdir('.hg') -hg.repository(u, 'patches', create=1) -chdir(os.path.pardir) -chdir(os.path.pardir) mkdir('subsubdir') chdir('subsubdir') hg.repository(u, 'subsub1', create=1) @@ -28,12 +22,12 @@ def runtest(): reposet = frozenset(walkrepos('.', followsym=True)) - if sym and (len(reposet) != 5): + if sym and (len(reposet) != 3): print "reposet = %r" % (reposet,) - raise SystemExit(1, "Found %d repositories when I should have found 5" % (len(reposet),)) - if (not sym) and (len(reposet) != 4): + raise SystemExit(1, "Found %d repositories when I should have found 3" % (len(reposet),)) + if (not sym) and (len(reposet) != 2): print "reposet = %r" % (reposet,) - raise SystemExit(1, "Found %d repositories when I should have found 4" % (len(reposet),)) + raise SystemExit(1, "Found %d repositories when I should have found 2" % (len(reposet),)) sub1set = frozenset((pjoin('.', 'sub1'), pjoin('.', 'circle', 'subdir', 'sub1'))) if len(sub1set & reposet) != 1: