Show More
@@ -335,7 +335,7 b' class hgweb(object):' | |||||
335 | req.url = req.env['SCRIPT_NAME'] |
|
335 | req.url = req.env['SCRIPT_NAME'] | |
336 | if not req.url.endswith('/'): |
|
336 | if not req.url.endswith('/'): | |
337 | req.url += '/' |
|
337 | req.url += '/' | |
338 |
if 'REPO_NAME' |
|
338 | if req.env.get('REPO_NAME'): | |
339 | req.url += req.env['REPO_NAME'] + '/' |
|
339 | req.url += req.env['REPO_NAME'] + '/' | |
340 |
|
340 | |||
341 | if 'PATH_INFO' in req.env: |
|
341 | if 'PATH_INFO' in req.env: |
@@ -257,7 +257,7 b' class hgwebdir(object):' | |||||
257 |
|
257 | |||
258 | repos = dict(self.repos) |
|
258 | repos = dict(self.repos) | |
259 |
|
259 | |||
260 |
if not virtual or |
|
260 | if (not virtual or virtual == 'index') and virtual not in repos: | |
261 | req.respond(HTTP_OK, ctype) |
|
261 | req.respond(HTTP_OK, ctype) | |
262 | return self.makeindex(req, tmpl) |
|
262 | return self.makeindex(req, tmpl) | |
263 |
|
263 | |||
@@ -269,8 +269,17 b' class hgwebdir(object):' | |||||
269 | req.respond(HTTP_OK, ctype) |
|
269 | req.respond(HTTP_OK, ctype) | |
270 | return self.makeindex(req, tmpl, subdir) |
|
270 | return self.makeindex(req, tmpl, subdir) | |
271 |
|
271 | |||
272 |
|
|
272 | def _virtualdirs(): | |
273 | while virtualrepo: |
|
273 | # Check the full virtual path, each parent, and the root ('') | |
|
274 | if virtual != '': | |||
|
275 | yield virtual | |||
|
276 | ||||
|
277 | for p in util.finddirs(virtual): | |||
|
278 | yield p | |||
|
279 | ||||
|
280 | yield '' | |||
|
281 | ||||
|
282 | for virtualrepo in _virtualdirs(): | |||
274 | real = repos.get(virtualrepo) |
|
283 | real = repos.get(virtualrepo) | |
275 | if real: |
|
284 | if real: | |
276 | req.env['REPO_NAME'] = virtualrepo |
|
285 | req.env['REPO_NAME'] = virtualrepo | |
@@ -284,11 +293,6 b' class hgwebdir(object):' | |||||
284 | except error.RepoError as inst: |
|
293 | except error.RepoError as inst: | |
285 | raise ErrorResponse(HTTP_SERVER_ERROR, str(inst)) |
|
294 | raise ErrorResponse(HTTP_SERVER_ERROR, str(inst)) | |
286 |
|
295 | |||
287 | up = virtualrepo.rfind('/') |
|
|||
288 | if up < 0: |
|
|||
289 | break |
|
|||
290 | virtualrepo = virtualrepo[:up] |
|
|||
291 |
|
||||
292 | # browse subdirectories |
|
296 | # browse subdirectories | |
293 | subdir = virtual + '/' |
|
297 | subdir = virtual + '/' | |
294 | if [r for r in repos if r.startswith(subdir)]: |
|
298 | if [r for r in repos if r.startswith(subdir)]: |
@@ -1680,6 +1680,22 b" Repos named 'index' take precedence over" | |||||
1680 |
|
1680 | |||
1681 | $ killdaemons.py |
|
1681 | $ killdaemons.py | |
1682 |
|
1682 | |||
|
1683 | $ cat > paths.conf << EOF | |||
|
1684 | > [paths] | |||
|
1685 | > / = $root/a | |||
|
1686 | > EOF | |||
|
1687 | $ hg serve -p $HGPORT1 -d --pid-file hg.pid --webdir-conf paths.conf | |||
|
1688 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
1689 | ||||
|
1690 | $ hg id http://localhost:$HGPORT1 | |||
|
1691 | 71a89161f014 | |||
|
1692 | ||||
|
1693 | $ get-with-headers.py localhost:$HGPORT1 '' | grep 'index' | |||
|
1694 | <meta name="robots" content="index, nofollow" /> | |||
|
1695 | <a href="/rev/71a89161f014">add index file</a> | |||
|
1696 | ||||
|
1697 | $ killdaemons.py | |||
|
1698 | ||||
1683 | paths errors 1 |
|
1699 | paths errors 1 | |
1684 |
|
1700 | |||
1685 | $ cat error-paths-1.log |
|
1701 | $ cat error-paths-1.log |
General Comments 0
You need to be logged in to leave comments.
Login now