Mercurial > hg
view tests/hgweberror.py @ 46059:dacb771f6dd2
copies-rust: extract the processing of a ChangedFiles in its own function
This is a reasonably independent piece of code that we can extract in its own
function. This extraction will be very useful for the next changeset, where we
will change the iteration order (but still do the same kind of processing).
Differential Revision: https://phab.mercurial-scm.org/D9421
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 20 Nov 2020 14:17:08 +0100 |
parents | 2372284d9457 |
children | 6000f5b25c9b |
line wrap: on
line source
# A dummy extension that installs an hgweb command that throws an Exception. from __future__ import absolute_import from mercurial.hgweb import webcommands def raiseerror(web): '''Dummy web command that raises an uncaught Exception.''' # Simulate an error after partial response. if b'partialresponse' in web.req.qsparams: web.res.status = b'200 Script output follows' web.res.headers[b'Content-Type'] = b'text/plain' web.res.setbodywillwrite() list(web.res.sendresponse()) web.res.getbodyfile().write(b'partial content\n') raise AttributeError('I am an uncaught error!') def extsetup(ui): setattr(webcommands, 'raiseerror', raiseerror) webcommands.__all__.append(b'raiseerror')