highlight: inline checkfctx()
It is only used once. pygmentize() is pretty small. Let's just inline
it.
--- a/hgext/highlight/__init__.py Wed Oct 14 17:42:07 2015 -0700
+++ b/hgext/highlight/__init__.py Wed Oct 14 17:43:44 2015 -0700
@@ -29,16 +29,14 @@
# leave the attribute unspecified.
testedwith = 'internal'
-def checkfctx(fctx, expr):
+def pygmentize(web, field, fctx, tmpl):
+ style = web.config('web', 'pygments_style', 'colorful')
+ expr = web.config('web', 'highlightfiles', "size('<5M')")
+
ctx = fctx.changectx()
tree = fileset.parse(expr)
mctx = fileset.matchctx(ctx, subset=[fctx.path()], status=None)
- return fctx.path() in fileset.getset(mctx, tree)
-
-def pygmentize(web, field, fctx, tmpl):
- style = web.config('web', 'pygments_style', 'colorful')
- expr = web.config('web', 'highlightfiles', "size('<5M')")
- if checkfctx(fctx, expr):
+ if fctx.path() in fileset.getset(mctx, tree):
highlight.pygmentize(field, fctx, style, tmpl)
def filerevision_highlight(orig, web, req, tmpl, fctx):