##// END OF EJS Templates
memory optimizations, call diffs only when needed ie. after checking for binary, and cutoff limit....
marcink -
r1149:d162de13 beta
parent child Browse files
Show More
@@ -244,27 +244,29 b' class FilesController(BaseRepoController'
244 return diff.raw_diff()
244 return diff.raw_diff()
245
245
246 elif c.action == 'diff':
246 elif c.action == 'diff':
247 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
247
248 if node1.is_binary or node2.is_binary:
249 c.cur_diff = _('Binary file')
250 elif node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
251 c.cur_diff = _('Diff is too big to display')
252 else:
253 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
248 format='gitdiff')
254 format='gitdiff')
249
250 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
251 c.cur_diff = _('Diff is to big to display')
252 elif node1.is_binary or node2.is_binary:
253 c.cur_diff = _('Binary file')
254 else:
255 c.cur_diff = diff.as_html()
255 c.cur_diff = diff.as_html()
256 else:
256 else:
257 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
257
258 format='gitdiff')
259 #default option
258 #default option
260 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
259 if node1.is_binary or node2.is_binary:
261 c.cur_diff = _('Diff is to big to display')
262 elif node1.is_binary or node2.is_binary:
263 c.cur_diff = _('Binary file')
260 c.cur_diff = _('Binary file')
261 elif node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
262 c.cur_diff = _('Diff is too big to display')
264 else:
263 else:
264 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
265 format='gitdiff')
265 c.cur_diff = diff.as_html()
266 c.cur_diff = diff.as_html()
266
267
267 if not c.cur_diff: c.no_changes = True
268 if not c.cur_diff:
269 c.no_changes = True
268 return render('files/file_diff.html')
270 return render('files/file_diff.html')
269
271
270 def _get_history(self, repo, node, f_path):
272 def _get_history(self, repo, node, f_path):
General Comments 0
You need to be logged in to leave comments. Login now