mercurial/hgweb/hgwebdir_mod.py
changeset 27043 ccdc95c6841e
parent 27007 c8cbef073645
child 27045 eac72c1e1e0d
equal deleted inserted replaced
27042:30b919bc49bf 27043:ccdc95c6841e
    11 from mercurial import hg, scmutil, util, templater
    11 from mercurial import hg, scmutil, util, templater
    12 from mercurial import ui as uimod
    12 from mercurial import ui as uimod
    13 from mercurial import error, encoding
    13 from mercurial import error, encoding
    14 from common import ErrorResponse, get_mtime, staticfile, paritygen, ismember, \
    14 from common import ErrorResponse, get_mtime, staticfile, paritygen, ismember, \
    15                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    15                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    16 from hgweb_mod import hgweb, makebreadcrumb
    16 import hgweb_mod
    17 from request import wsgirequest
    17 from request import wsgirequest
    18 import webutil
    18 import webutil
    19 
    19 
    20 def cleannames(items):
    20 def cleannames(items):
    21     return [(util.pconvert(name).strip('/'), path) for name, path in items]
    21     return [(util.pconvert(name).strip('/'), path) for name, path in items]
   230                 if real:
   230                 if real:
   231                     req.env['REPO_NAME'] = virtualrepo
   231                     req.env['REPO_NAME'] = virtualrepo
   232                     try:
   232                     try:
   233                         # ensure caller gets private copy of ui
   233                         # ensure caller gets private copy of ui
   234                         repo = hg.repository(self.ui.copy(), real)
   234                         repo = hg.repository(self.ui.copy(), real)
   235                         return hgweb(repo).run_wsgi(req)
   235                         return hgweb_mod.hgweb(repo).run_wsgi(req)
   236                     except IOError as inst:
   236                     except IOError as inst:
   237                         msg = inst.strerror
   237                         msg = inst.strerror
   238                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
   238                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
   239                     except error.RepoError as inst:
   239                     except error.RepoError as inst:
   240                         raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
   240                         raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
   425 
   425 
   426         self.refresh()
   426         self.refresh()
   427         self.updatereqenv(req.env)
   427         self.updatereqenv(req.env)
   428 
   428 
   429         return tmpl("index", entries=entries, subdir=subdir,
   429         return tmpl("index", entries=entries, subdir=subdir,
   430                     pathdef=makebreadcrumb('/' + subdir, self.prefix),
   430                     pathdef=hgweb_mod.makebreadcrumb('/' + subdir, self.prefix),
   431                     sortcolumn=sortcolumn, descending=descending,
   431                     sortcolumn=sortcolumn, descending=descending,
   432                     **dict(sort))
   432                     **dict(sort))
   433 
   433 
   434     def templater(self, req):
   434     def templater(self, req):
   435 
   435