Commit cbe78144 authored by Steve Borho's avatar Steve Borho
Browse files

fileview: return diff as local text lines

Allow caller to strip lines and/or convert to unicode if/when they need
parent 9cc5ea6e39e6
......@@ -166,7 +166,8 @@ class DiffBrowser(QFrame):
self.sci.setLexer(lexer)
# TODO: do patch chunking here using record.parsepatch()
# TODO: use indicators to represent current and selection state
self.sci.setText(fd.diff)
utext = [hglib.tounicode(l) for l in fd.diff[2:]]
self.sci.setText(u'\n'.join(utext))
def run(ui, *pats, **opts):
'for testing purposes only'
......
......@@ -326,7 +326,8 @@ class HgFileView(QFrame):
if self._mode == 'diff' and fd.diff:
lexer = get_diff_lexer(self)
self.sci.setLexer(lexer)
self.sci.setText(fd.diff)
utext = [hglib.tounicode(l) for l in fd.diff[2:]]
self.sci.setText(u'\n'.join(utext))
elif fd.contents is None:
return
else:
......@@ -584,7 +585,7 @@ class FileData(object):
if type(ctx.rev()) == str: # unapplied patch
chunks = ctx.thgmqpatchchunks(wfile)
self.diff = '\n'.join(chunks)
self.diff = '\n'.join(chunks).splitlines()
return
if status is None:
......@@ -705,5 +706,4 @@ class FileData(object):
else:
for chunkline in gen:
data.append(chunkline)
data = [hglib.tounicode(l) for l in data]
self.diff = u'\n'.join(data[2:])
self.diff = data
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment