# HG changeset patch # User Gregory Szorc # Date 2015-10-15 00:43:44 # Node ID 0d93df4d1e44eb94fb70b6baa18475f992a2dca4 # Parent 613d850cce53c1b755de414b5265d4875652431c highlight: inline checkfctx() It is only used once. pygmentize() is pretty small. Let's just inline it. diff --git a/hgext/highlight/__init__.py b/hgext/highlight/__init__.py --- a/hgext/highlight/__init__.py +++ b/hgext/highlight/__init__.py @@ -29,16 +29,14 @@ from mercurial import extensions, encodi # 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):