Changeset d6c0fc595f4c…
Parent e03500e86fe9…
by
Changes to 3 files · Browse files at d6c0fc595f4c Showing diff from parent e03500e86fe9 Diff from another changeset...
@@ -273,7 +273,7 @@ wlock = repo.wlock()
try:
repo.wopener(self.currentFile, 'wb').write(
- repo['.'][self.currentFile].data())
+ self.diffbrowse.origcontents)
fp = cStringIO.StringIO()
chunks[0].write(fp)
for c in kchunks:
@@ -687,6 +687,7 @@ else:
self.sci.markerAdd(start+i, self.vertical)
start += len(chunk.lines) + 1
+ self.origcontents = fd.olddata
self.countselected = 0
self.curchunks = chunks
for c in chunks[1:]:
|
@@ -16,6 +16,7 @@ class FileData(object):
def __init__(self, ctx, ctx2, wfile, status=None):
self.contents = None
+ self.ucontents = None
self.error = None
self.olddata = None
self.diff = None
@@ -91,7 +92,7 @@ data = ctx[wfile].data()
else:
data = os.readlink(absfile)
- self.contents = hglib.tounicode(data)
+ self.contents = data
self.flabel += _(' <i>(is a symlink)</i>')
return
@@ -208,7 +209,7 @@ out += subrepochange
if data:
sstatedesc += ' and dirty'
- self.contents = u''.join(out)
+ self.ucontents = u''.join(out)
if not sactual:
sstatedesc = 'removed'
lbl = {
@@ -244,7 +245,7 @@ if '\0' in olddata:
self.error = 'binary file'
else:
- self.contents = hglib.tounicode(olddata)
+ self.contents = olddata
self.flabel += _(' <i>(was deleted)</i>')
else:
self.flabel += _(' <i>(was added, now missing)</i>')
@@ -258,7 +259,7 @@ if '\0' in data:
self.error = 'binary file'
else:
- self.contents = hglib.tounicode(data)
+ self.contents = data
if status in ('I', '?'):
self.flabel += _(' <i>(is unversioned)</i>')
return
@@ -268,7 +269,7 @@ if res is None:
return
fctx, newdata = res
- self.contents = hglib.tounicode(newdata)
+ self.contents = newdata
change = None
for pfctx in fctx.parents():
if 'x' in fctx.flags() and 'x' not in pfctx.flags():
@@ -299,7 +300,7 @@ else:
return
- self.olddata = hglib.tounicode(olddata)
+ self.olddata = olddata
newdate = util.datestr(ctx.date())
olddate = util.datestr(ctx2.date())
revs = [str(ctx), str(ctx2)]
|
@@ -341,8 +341,8 @@ return
candiff = bool(fd.diff)
- canfile = bool(fd.contents)
- canann = canfile and type(self._ctx.rev()) is int
+ canfile = bool(fd.contents or fd.ucontents)
+ canann = bool(fd.contents) and type(self._ctx.rev()) is int
if not candiff or not canfile:
self.restrictModes(candiff, canfile, canann)
@@ -367,7 +367,7 @@ lexer = lexers.get_diff_lexer(self)
self.sci.setLexer(lexer)
if lexer is None:
- self.setFont(qtlib.getfont('fontlog').font())
+ self.sci.setFont(qtlib.getfont('fontlog').font())
# trim first three lines, for example:
# diff -r f6bfc41af6d7 -r c1b18806486d tortoisehg/hgqt/thgrepo.py
# --- a/tortoisehg/hgqt/thgrepo.py
@@ -379,17 +379,23 @@ else:
# there was an error or rename without diffs
self.sci.setText(hglib.tounicode(fd.diff))
- elif fd.contents is None:
- return
- else:
+ elif fd.ucontents:
+ # subrepo summary and perhaps other data
+ self.sci.setText(fd.ucontents)
+ self.sci.setLexer(None)
+ self.sci.setFont(qtlib.getfont('fontlog').font())
+ self.sci._updatemarginwidth()
+ elif fd.contents:
lexer = lexers.get_lexer(filename, fd.contents, self)
self.sci.setLexer(lexer)
if lexer is None:
- self.setFont(qtlib.getfont('fontlog').font())
- self.sci.setText(fd.contents)
+ self.sci.setFont(qtlib.getfont('fontlog').font())
+ self.sci.setText(hglib.tounicode(fd.contents))
self.sci._updatemarginwidth()
if self._mode == AnnMode:
self.sci._updateannotation(self._ctx, filename)
+ else:
+ return
# Recover the last scroll position
# Make sure that lastScrollPosition never exceeds the amount of
@@ -399,7 +405,8 @@
self.highlightText(*self._lastSearch)
uf = hglib.tounicode(filename)
- self.fileDisplayed.emit(uf, fd.contents or QString())
+ uc = hglib.tounicode(fd.contents) or ''
+ self.fileDisplayed.emit(uf, uc)
if self._mode != DiffMode and fd.contents and fd.olddata:
# Update blk margin
|
Loading...