# HG changeset patch # User Benoit Allard # Date 1224692612 -7200 # Node ID b1aea76f7001c3fd1097a68f3d08e0e5c3de7a60 # Parent ca5ac40949dc84abfe3420037a6c6699114a1ed9 hgwebdir: show nested repositories (issue1336) diff -r ca5ac40949dc -r b1aea76f7001 mercurial/util.py --- a/mercurial/util.py Wed Oct 22 13:14:52 2008 +0200 +++ b/mercurial/util.py Wed Oct 22 18:23:32 2008 +0200 @@ -1852,7 +1852,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[:] = [] # don't descend further + dirs.remove('.hg') # don't recurse inside the .hg directory yield root # found a repository qroot = os.path.join(root, '.hg', 'patches') if os.path.isdir(os.path.join(qroot, '.hg')): diff -r ca5ac40949dc -r b1aea76f7001 tests/test-walkrepo.py --- a/tests/test-walkrepo.py Wed Oct 22 13:14:52 2008 +0200 +++ b/tests/test-walkrepo.py Wed Oct 22 18:23:32 2008 +0200 @@ -12,6 +12,12 @@ 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) @@ -22,12 +28,12 @@ def runtest(): reposet = frozenset(walkrepos('.', followsym=True)) - if sym and (len(reposet) != 3): + if sym and (len(reposet) != 5): print "reposet = %r" % (reposet,) - raise SystemExit(1, "Found %d repositories when I should have found 3" % (len(reposet),)) - if (not sym) and (len(reposet) != 2): + raise SystemExit(1, "Found %d repositories when I should have found 5" % (len(reposet),)) + if (not sym) and (len(reposet) != 4): print "reposet = %r" % (reposet,) - raise SystemExit(1, "Found %d repositories when I should have found 2" % (len(reposet),)) + raise SystemExit(1, "Found %d repositories when I should have found 4" % (len(reposet),)) sub1set = frozenset((pjoin('.', 'sub1'), pjoin('.', 'circle', 'subdir', 'sub1'))) if len(sub1set & reposet) != 1: