6 # This software may be used and distributed according to the terms |
6 # This software may be used and distributed according to the terms |
7 # of the GNU General Public License, incorporated herein by reference. |
7 # of the GNU General Public License, incorporated herein by reference. |
8 |
8 |
9 import os |
9 import os |
10 from mercurial.i18n import gettext as _ |
10 from mercurial.i18n import gettext as _ |
|
11 from mercurial.repo import RepoError |
11 from mercurial import ui, hg, util, templater, templatefilters |
12 from mercurial import ui, hg, util, templater, templatefilters |
12 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen,\ |
13 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen,\ |
13 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
14 from hgweb_mod import hgweb |
15 from hgweb_mod import hgweb |
15 from request import wsgirequest |
16 from request import wsgirequest |
108 hgweb(repo).run_wsgi(req) |
109 hgweb(repo).run_wsgi(req) |
109 return |
110 return |
110 except IOError, inst: |
111 except IOError, inst: |
111 msg = inst.strerror |
112 msg = inst.strerror |
112 raise ErrorResponse(HTTP_SERVER_ERROR, msg) |
113 raise ErrorResponse(HTTP_SERVER_ERROR, msg) |
113 except hg.RepoError, inst: |
114 except RepoError, inst: |
114 raise ErrorResponse(HTTP_SERVER_ERROR, str(inst)) |
115 raise ErrorResponse(HTTP_SERVER_ERROR, str(inst)) |
115 |
116 |
116 # browse subdirectories |
117 # browse subdirectories |
117 subdir = virtual + '/' |
118 subdir = virtual + '/' |
118 if [r for r in repos if r.startswith(subdir)]: |
119 if [r for r in repos if r.startswith(subdir)]: |