changeset 26679:0d93df4d1e44

highlight: inline checkfctx() It is only used once. pygmentize() is pretty small. Let's just inline it.
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 14 Oct 2015 17:43:44 -0700
parents 613d850cce53
children 7a3f6490ef97
files hgext/highlight/__init__.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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):