Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

filedata: keep file contents in raw/local encoding as long as possible

Also disallow annotate for subrepo summaries

Changeset d6c0fc595f4c

Parent e03500e86fe9

by Steve Borho

Changes to 3 files · Browse files at d6c0fc595f4c Showing diff from parent e03500e86fe9 Diff from another changeset...

 
273
274
275
276
 
277
278
279
 
687
688
689
 
690
691
692
 
273
274
275
 
276
277
278
279
 
687
688
689
690
691
692
693
@@ -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
17
18
 
19
20
21
 
91
92
93
94
 
95
96
97
 
208
209
210
211
 
212
213
214
 
244
245
246
247
 
248
249
250
 
258
259
260
261
 
262
263
264
 
268
269
270
271
 
272
273
274
 
299
300
301
302
 
303
304
305
 
16
17
18
19
20
21
22
 
92
93
94
 
95
96
97
98
 
209
210
211
 
212
213
214
215
 
245
246
247
 
248
249
250
251
 
259
260
261
 
262
263
264
265
 
269
270
271
 
272
273
274
275
 
300
301
302
 
303
304
305
306
@@ -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
342
343
344
345
 
 
346
347
348
 
367
368
369
370
 
371
372
373
 
379
380
381
382
383
384
 
 
 
 
 
 
 
385
386
387
388
389
 
 
390
391
392
 
 
393
394
395
 
399
400
401
402
 
 
403
404
405
 
341
342
343
 
 
344
345
346
347
348
 
367
368
369
 
370
371
372
373
 
379
380
381
 
 
 
382
383
384
385
386
387
388
389
390
391
 
 
392
393
394
395
396
397
398
399
400
401
 
405
406
407
 
408
409
410
411
412
@@ -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