# HG changeset patch # User Brendan Cully # Date 1204265062 28800 # Node ID fe54e7501de1c88de321e02c66577b6a90f0451c # Parent 2344da8eb9b49e25c96fe475bd1044d8116d85b4 highlight: bail out if file is binary diff -r 2344da8eb9b4 -r fe54e7501de1 hgext/highlight.py --- a/hgext/highlight.py Thu Feb 28 21:35:27 2008 -0800 +++ b/hgext/highlight.py Thu Feb 28 22:04:22 2008 -0800 @@ -55,9 +55,12 @@ 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)