mercurial/hgweb/hgweb_mod.py
changeset 7637 1d54e2f6c0b7
parent 7633 08cabecfa8a8
child 7740 176d3d681702
equal deleted inserted replaced
7636:e3f8c6d6b72e 7637:1d54e2f6c0b7
     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, mimetypes
     9 import os, mimetypes
    10 from mercurial.node import hex, nullid
    10 from mercurial.node import hex, nullid
    11 from mercurial.repo import RepoError
       
    12 from mercurial import ui, hg, util, hook, error
    11 from mercurial import ui, hg, util, hook, error
    13 from mercurial import templater, templatefilters
    12 from mercurial import templater, templatefilters
    14 from common import get_mtime, style_map, ErrorResponse
    13 from common import get_mtime, style_map, ErrorResponse
    15 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    14 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    16 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED
    15 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED
   189             req.respond(HTTP_NOT_FOUND, ctype)
   188             req.respond(HTTP_NOT_FOUND, ctype)
   190             msg = str(err)
   189             msg = str(err)
   191             if 'manifest' not in msg:
   190             if 'manifest' not in msg:
   192                 msg = 'revision not found: %s' % err.name
   191                 msg = 'revision not found: %s' % err.name
   193             return tmpl('error', error=msg)
   192             return tmpl('error', error=msg)
   194         except (RepoError, error.RevlogError), inst:
   193         except (error.RepoError, error.RevlogError), inst:
   195             req.respond(HTTP_SERVER_ERROR, ctype)
   194             req.respond(HTTP_SERVER_ERROR, ctype)
   196             return tmpl('error', error=str(inst))
   195             return tmpl('error', error=str(inst))
   197         except ErrorResponse, inst:
   196         except ErrorResponse, inst:
   198             req.respond(inst.code, ctype)
   197             req.respond(inst.code, ctype)
   199             return tmpl('error', error=inst.message)
   198             return tmpl('error', error=inst.message)