tests/hgweberror.py
author Mike Edgar <adgar@google.com>
Fri, 06 Feb 2015 01:44:24 +0000
changeset 24117 9cfd7c4f22f5
parent 23409 dc4d2cd3aa3e
child 27299 74e6de99ce7f
permissions -rw-r--r--
filelog: allow censored files to contain padding data To ensure delta compatibility, when a revision is censored, it is padded to match the original data in size. The previous check does not allow for padding because it was added before padding was found to be a requirement. For more background and design of the censorship feature, see: mercurial.selenic.com/wiki/CensorPlan

# A dummy extension that installs an hgweb command that throws an Exception.

from mercurial.hgweb import webcommands

def raiseerror(web, req, tmpl):
    '''Dummy web command that raises an uncaught Exception.'''

    # Simulate an error after partial response.
    if 'partialresponse' in req.form:
        req.respond(200, 'text/plain')
        req.write('partial content\n')

    raise AttributeError('I am an uncaught error!')

def extsetup(ui):
    setattr(webcommands, 'raiseerror', raiseerror)
    webcommands.__all__.append('raiseerror')