diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -254,13 +254,21 @@ class hgwebdir(object): return [] # top-level index - elif not virtual: + + repos = dict(self.repos) + + if not virtual or (virtual == 'index' and virtual not in repos): req.respond(HTTP_OK, ctype) return self.makeindex(req, tmpl) # nested indexes and hgwebs - repos = dict(self.repos) + if virtual.endswith('/index') and virtual not in repos: + subdir = virtual[:-len('index')] + if any(r.startswith(subdir) for r in repos): + req.respond(HTTP_OK, ctype) + return self.makeindex(req, tmpl, subdir) + virtualrepo = virtual while virtualrepo: real = repos.get(virtualrepo) @@ -352,8 +360,7 @@ class hgwebdir(object): pass parts = [name] - if 'PATH_INFO' in req.env: - parts.insert(0, req.env['PATH_INFO'].rstrip('/')) + parts.insert(0, '/' + subdir.rstrip('/')) if req.env['SCRIPT_NAME']: parts.insert(0, req.env['SCRIPT_NAME']) url = re.sub(r'/+', '/', '/'.join(parts) + '/') diff --git a/tests/test-hgwebdir.t b/tests/test-hgwebdir.t --- a/tests/test-hgwebdir.t +++ b/tests/test-hgwebdir.t @@ -1566,6 +1566,119 @@ immediately. /b/ /c/ + $ killdaemons.py + $ cat > paths.conf << EOF + > [paths] + > /dir1/a_repo = $root/a + > /dir1/a_repo/b_repo = $root/b + > /dir1/dir2/index = $root/b + > EOF + $ hg serve -p $HGPORT1 -d --pid-file hg.pid --webdir-conf paths.conf + $ cat hg.pid >> $DAEMON_PIDS + + $ echo 'index file' > $root/a/index + $ hg --cwd $root/a ci -Am 'add index file' + adding index + + $ get-with-headers.py localhost:$HGPORT1 '' | grep 'a_repo' + dir1/a_repo + + dir1/a_repo/b_repo + + + $ get-with-headers.py localhost:$HGPORT1 'index' | grep 'a_repo' + dir1/a_repo + + dir1/a_repo/b_repo + + + $ get-with-headers.py localhost:$HGPORT1 'dir1' | grep 'a_repo' + a_repo + + a_repo/b_repo + + + $ get-with-headers.py localhost:$HGPORT1 'dir1/index' | grep 'a_repo' + a_repo + + a_repo/b_repo + + + $ get-with-headers.py localhost:$HGPORT1 'dir1/a_repo' | grep 'a_repo' + + + + dir1/a_repo: log + href="/dir1/a_repo/atom-log" title="Atom feed for dir1/a_repo" /> + href="/dir1/a_repo/rss-log" title="RSS feed for dir1/a_repo" /> + mercurial +
  • graph
  • +
  • tags
  • +
  • bookmarks
  • +
  • branches
  • +
  • changeset
  • +
  • browse
  • +
  • help
  • + + + +