Changeset 12221e04f04f…
Parent c9f8f5ac2344…
by
Changes to 2 files · Browse files at 12221e04f04f Showing diff from parent c9f8f5ac2344 Diff from another changeset...
@@ -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,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:
|
Loading...