# HG changeset patch # User Anton Shestakov # Date 1442413836 -28800 # Node ID 3166bcc0c53840833e4223f123731fc420c0d3d3 # Parent 99b6afff09ae3c947d2770613be898d8333cc1ad highlight: add highlightfiles config option which takes a fileset (issue3005) Highlight extension lacked a way to limit files by size, by extension, and/or by any other part of file path. A good solution would be to use a fileset, since it can check file path, extension and size (and more) in one expression. So this change introduces such an option, highlighfiles, which takes a fileset and on each request decides if the requested file should be highlighted. The default "size('<5M')" is, in a way, suggested in issue3005. checkfctx() limits the amount of work to just one file (subset kwarg in fileset.matchctx()). Monkey-patching works around issue4568, otherwise using filesets here while running hgweb in directory mode would say, for example, "Abort: **.py not under root", but this fix is very local and probably far from ideal. I suspect there to be a way to fix this for the whole hgweb and resolve the issue, but I don't know how to do it. diff -r 99b6afff09ae -r 3166bcc0c538 hgext/highlight/__init__.py --- a/hgext/highlight/__init__.py Fri Sep 04 11:15:02 2015 -0400 +++ b/hgext/highlight/__init__.py Wed Sep 16 22:30:36 2015 +0800 @@ -13,23 +13,32 @@ It depends on the Pygments syntax highlighting library: http://pygments.org/ -There is a single configuration option:: +There are two configuration options:: [web] - pygments_style =