50
49
file_name = os.path.basename(self._history.get_path(revid, file_id))
52
file_text = tree.get_file_text(file_id)
55
file_text = file_text.decode(encoding)
56
except UnicodeDecodeError:
57
encoding = 'iso-8859-15'
58
file_text = file_text.decode(encoding)
60
file_lines = bzrlib.osutils.split_lines(file_text)
52
file_lines = tree.get_file_lines(file_id)
63
53
bzrlib.textfile.check_text_lines(file_lines)
64
54
except bzrlib.errors.BinaryFile:
65
# bail out; this isn't displayable text
66
yield util.Container(parity=0, lineno=1, status='same',
67
text='(This is a binary file.)',
68
change=util.Container())
55
# bail out; this isn't displayable text
56
yield util.Container(parity=0, lineno=1, status='same',
57
text='(This is a binary file.)',
58
change=util.Container())
70
60
if highlight is not None:
71
hl_lines = highlight(file_name, file_text, encoding)
61
hl_lines = highlight(file_name, ''.join(file_lines))
72
62
hl_lines.extend([u''] * (len(file_lines) - len(hl_lines)))
74
64
hl_lines = map(cgi.escape, file_lines)
95
85
change=change, text=hl_lines[lineno - 1])
98
self.log.debug('annotate: %r secs' % (time.time() - z,))
88
self.log.debug('annotate: %r secs' % (time.time() - z))
100
90
def get_values(self, path, kwargs, headers):
101
91
history = self._history