hgext/highlight/__init__.py
changeset 26295 e7cb19b1ef2b
parent 26249 3166bcc0c538
child 26678 613d850cce53
equal deleted inserted replaced
26294:1ffc61c4e32e 26295:e7cb19b1ef2b
    31 
    31 
    32 def checkfctx(fctx, expr):
    32 def checkfctx(fctx, expr):
    33     ctx = fctx.changectx()
    33     ctx = fctx.changectx()
    34     tree = fileset.parse(expr)
    34     tree = fileset.parse(expr)
    35     mctx = fileset.matchctx(ctx, subset=[fctx.path()], status=None)
    35     mctx = fileset.matchctx(ctx, subset=[fctx.path()], status=None)
    36     repo = ctx.repo()
       
    37     # To allow matching file names in the fileset in hgweb directory mode.
       
    38     # See issue4568.
       
    39     object.__setattr__(repo, 'getcwd', lambda: repo.root)
       
    40     return fctx.path() in fileset.getset(mctx, tree)
    36     return fctx.path() in fileset.getset(mctx, tree)
    41 
    37 
    42 def filerevision_highlight(orig, web, req, tmpl, fctx):
    38 def filerevision_highlight(orig, web, req, tmpl, fctx):
    43     mt = ''.join(tmpl('mimetype', encoding=encoding.encoding))
    39     mt = ''.join(tmpl('mimetype', encoding=encoding.encoding))
    44     # only pygmentize for mimetype containing 'html' so we both match
    40     # only pygmentize for mimetype containing 'html' so we both match