hgext/highlight/highlight.py
changeset 37084 f0b6fbea00cf
parent 35329 169d66db5920
child 37843 670eb4fa1b86
equal deleted inserted replaced
37083:f99d64e8a4e4 37084:f0b6fbea00cf
    13 from mercurial import demandimport
    13 from mercurial import demandimport
    14 demandimport.ignore.extend(['pkgutil', 'pkg_resources', '__main__'])
    14 demandimport.ignore.extend(['pkgutil', 'pkg_resources', '__main__'])
    15 
    15 
    16 from mercurial import (
    16 from mercurial import (
    17     encoding,
    17     encoding,
    18     util,
    18 )
       
    19 
       
    20 from mercurial.utils import (
       
    21     stringutil,
    19 )
    22 )
    20 
    23 
    21 with demandimport.deactivated():
    24 with demandimport.deactivated():
    22     import pygments
    25     import pygments
    23     import pygments.formatters
    26     import pygments.formatters
    45     if SYNTAX_CSS not in old_header:
    48     if SYNTAX_CSS not in old_header:
    46         new_header = old_header + SYNTAX_CSS
    49         new_header = old_header + SYNTAX_CSS
    47         tmpl.cache['header'] = new_header
    50         tmpl.cache['header'] = new_header
    48 
    51 
    49     text = fctx.data()
    52     text = fctx.data()
    50     if util.binary(text):
    53     if stringutil.binary(text):
    51         return
    54         return
    52 
    55 
    53     # str.splitlines() != unicode.splitlines() because "reasons"
    56     # str.splitlines() != unicode.splitlines() because "reasons"
    54     for c in "\x0c\x1c\x1d\x1e":
    57     for c in "\x0c\x1c\x1d\x1e":
    55         if c in text:
    58         if c in text: