hgext/highlight/__init__.py
changeset 26679 0d93df4d1e44
parent 26678 613d850cce53
child 26680 7a3f6490ef97
--- 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):