##// END OF EJS Templates
style: run a patched black on a subset of mercurial...
style: run a patched black on a subset of mercurial This applied black to the 20 smallest files in mercurial/: ls -S1 mercurial/*.py | tail -n20 | xargs black --skip-string-normalization Note that a few files failed to format, presumably due to a bug in my patch. The intent is to be able to compare results to D5064 with https://github.com/python/black/pull/826 applied to black. I skipped string normalization on this patch for clarity - in reality I think we'd want one pass without string normalization, followed by another to normalize strings (which is basically replacing ' with " globally.) # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6342

File last commit:

r40191:0199fb5d default
r43345:57875cf4 default
Show More
hgweberror.py
24 lines | 758 B | text/x-python | PythonLexer
# 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')