Skip to content
Snippets Groups Projects
Commit 2570dca0 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

highlight: use matcher API to test if file should be pygmentized

Prepares for the upcoming API change. We'll no longer have to call the
fileset function directly since the cost of the matcher-based fileset will
become O(number of tests) from O(number of files in subset).
parent 1500cbe2
Branches
Tags
No related merge requests found
......@@ -36,7 +36,6 @@
from mercurial import (
extensions,
fileset,
)
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
......@@ -51,9 +50,8 @@
filenameonly = web.configbool('web', 'highlightonlymatchfilename', False)
ctx = fctx.changectx()
tree = fileset.parse(expr)
mctx = fileset.matchctx(ctx, subset=[fctx.path()], status=None)
if fctx.path() in fileset.getset(mctx, tree):
m = ctx.matchfileset(expr)
if m(fctx.path()):
highlight.pygmentize(field, fctx, style, tmpl,
guessfilenameonly=filenameonly)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment