# HG changeset patch # User Brendan Cully # Date 2008-02-29 06:04:22 # Node ID fe54e7501de1c88de321e02c66577b6a90f0451c # Parent 2344da8eb9b49e25c96fe475bd1044d8116d85b4 highlight: bail out if file is binary diff --git a/hgext/highlight.py b/hgext/highlight.py --- a/hgext/highlight.py +++ b/hgext/highlight.py @@ -55,9 +55,12 @@ def pygmentize(self, tmpl, fctx, field): new_header = old_header + SYNTAX_CSS tmpl.cache['header'] = new_header + text = fctx.data() + if util.binary(text): + return + style = self.config("web", "pygments_style", "colorful") # To get multi-line strings right, we can't format line-by-line - text = fctx.data() try: lexer = guess_lexer_for_filename(fctx.path(), text, encoding=util._encoding)