Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.1, 1.1.1, and 1.1.2

status: move check_max_diff to chunks.py

Changeset 12221e04f04f

Parent c9f8f5ac2344

by Adrian Buehlmann

Changes to 2 files · Browse files at 12221e04f04f Showing diff from parent c9f8f5ac2344 Diff from another changeset...

 
57
58
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
61
62
 
337
338
339
340
 
341
342
343
 
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
353
354
355
 
356
357
358
359
@@ -57,6 +57,22 @@
  return hunk     +def check_max_diff(ctx, pfile): + lines = [] + try: + fctx = ctx.filectx(pfile) + except error.LookupError: + fctx = None + if fctx and fctx.size() > hglib.getmaxdiffsize(ctx._repo.ui): + # Fake patch that displays size warning + lines = ['diff --git a/%s b/%s\n' % (pfile, pfile)] + lines.append(_('File is larger than the specified max size.\n')) + lines.append(_('Hunk selection is disabled for this file.\n')) + lines.append('--- a/%s\n' % pfile) + lines.append('+++ b/%s\n' % pfile) + return lines + +  class chunks(object):     def __init__(self, stat): @@ -337,7 +353,7 @@
  'Get diffs of working file, parse into (c)hunks'   difftext = cStringIO.StringIO()   pfile = util.pconvert(wfile) - lines = self.stat.check_max_diff(pfile) + lines = check_max_diff(self.stat.get_ctx(), pfile)   if lines:   difftext.writelines(lines)   difftext.seek(0)
 
724
725
726
 
 
 
727
728
729
 
914
915
916
917
 
918
919
920
 
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
 
724
725
726
727
728
729
730
731
732
 
917
918
919
 
920
921
922
923
 
956
957
958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
959
960
961
@@ -724,6 +724,9 @@
  def nodes(self):   return (self._node1, self._node2)   + def get_ctx(self): + return self.repo[self._node1] +   def set_file_states(self, paths, state=True):   for p in paths:   self.filemodel[p][FM_CHECKED] = state @@ -914,7 +917,7 @@
  def generate_text_diffs(self, row):   wfile = self.filemodel[row][FM_PATH]   pfile = util.pconvert(wfile) - lines = self.check_max_diff(pfile) + lines = chunks.check_max_diff(self.get_ctx(), pfile)   if lines:   return self.diff_highlight_buffer(lines)   matcher = cmdutil.matchfiles(self.repo, [pfile]) @@ -953,22 +956,6 @@
  if not self.is_merge() and self.chunks.len():   tree.scroll_to_cell(0, use_align=True, row_align=0.0)   - def check_max_diff(self, pfile): - lines = [] - ctx = self.repo[self._node1] - try: - fctx = ctx.filectx(pfile) - except error.LookupError: - fctx = None - if fctx and fctx.size() > hglib.getmaxdiffsize(self.repo.ui): - # Fake patch that displays size warning - lines = ['diff --git a/%s b/%s\n' % (pfile, pfile)] - lines.append(_('File is larger than the specified max size.\n')) - lines.append(_('Hunk selection is disabled for this file.\n')) - lines.append('--- a/%s\n' % pfile) - lines.append('+++ b/%s\n' % pfile) - return lines -   def update_check_state(self, wfile, partial, newvalue):   for fr in self.filemodel:   if fr[FM_PATH] == wfile: