##// END OF EJS Templates
Added handling of ignore whitespace flag in changesets...
marcink -
r1752:f28dc032 beta
parent child Browse files
Show More
@@ -254,7 +254,7 b' class ReposController(BaseController):'
254 h.flash(_('deleted repository %s') % repo_name, category='success')
254 h.flash(_('deleted repository %s') % repo_name, category='success')
255 Session.commit()
255 Session.commit()
256 except IntegrityError, e:
256 except IntegrityError, e:
257 if e.message.find('repositories_fork_id_fkey'):
257 if e.message.find('repositories_fork_id_fkey') != -1:
258 log.error(traceback.format_exc())
258 log.error(traceback.format_exc())
259 h.flash(_('Cannot delete %s it still contains attached '
259 h.flash(_('Cannot delete %s it still contains attached '
260 'forks') % repo_name,
260 'forks') % repo_name,
@@ -162,7 +162,7 b' class ReposGroupsController(BaseControll'
162 h.flash(_('removed repos group %s' % gr.group_name), category='success')
162 h.flash(_('removed repos group %s' % gr.group_name), category='success')
163 #TODO: in future action_logger(, '', '', '', self.sa)
163 #TODO: in future action_logger(, '', '', '', self.sa)
164 except IntegrityError, e:
164 except IntegrityError, e:
165 if e.message.find('groups_group_parent_id_fkey'):
165 if e.message.find('groups_group_parent_id_fkey') != -1:
166 log.error(traceback.format_exc())
166 log.error(traceback.format_exc())
167 h.flash(_('Cannot delete this group it still contains '
167 h.flash(_('Cannot delete this group it still contains '
168 'subgroups'),
168 'subgroups'),
@@ -59,7 +59,7 b' class ChangesetController(BaseRepoContro'
59 c.affected_files_cut_off = 60
59 c.affected_files_cut_off = 60
60
60
61 def index(self, revision):
61 def index(self, revision):
62
62 ignore_whitespace = request.GET.get('ignorews') == '1'
63 def wrap_to_table(str):
63 def wrap_to_table(str):
64
64
65 return '''<table class="code-difftable">
65 return '''<table class="code-difftable">
@@ -130,7 +130,8 b' class ChangesetController(BaseRepoContro'
130 # made
130 # made
131 c.sum_added += node.size
131 c.sum_added += node.size
132 if c.sum_added < self.cut_off_limit:
132 if c.sum_added < self.cut_off_limit:
133 f_gitdiff = differ.get_gitdiff(filenode_old, node)
133 f_gitdiff = differ.get_gitdiff(filenode_old, node,
134 ignore_whitespace=ignore_whitespace)
134 d = differ.DiffProcessor(f_gitdiff, format='gitdiff')
135 d = differ.DiffProcessor(f_gitdiff, format='gitdiff')
135
136
136 st = d.stat()
137 st = d.stat()
@@ -168,7 +169,8 b' class ChangesetController(BaseRepoContro'
168 else:
169 else:
169
170
170 if c.sum_removed < self.cut_off_limit:
171 if c.sum_removed < self.cut_off_limit:
171 f_gitdiff = differ.get_gitdiff(filenode_old, node)
172 f_gitdiff = differ.get_gitdiff(filenode_old, node,
173 ignore_whitespace=ignore_whitespace)
172 d = differ.DiffProcessor(f_gitdiff,
174 d = differ.DiffProcessor(f_gitdiff,
173 format='gitdiff')
175 format='gitdiff')
174 st = d.stat()
176 st = d.stat()
@@ -219,6 +221,7 b' class ChangesetController(BaseRepoContro'
219 def raw_changeset(self, revision):
221 def raw_changeset(self, revision):
220
222
221 method = request.GET.get('diff', 'show')
223 method = request.GET.get('diff', 'show')
224 ignore_whitespace = request.GET.get('ignorews') == '1'
222 try:
225 try:
223 c.scm_type = c.rhodecode_repo.alias
226 c.scm_type = c.rhodecode_repo.alias
224 c.changeset = c.rhodecode_repo.get_changeset(revision)
227 c.changeset = c.rhodecode_repo.get_changeset(revision)
@@ -237,7 +240,8 b' class ChangesetController(BaseRepoContro'
237 if filenode_old.is_binary or node.is_binary:
240 if filenode_old.is_binary or node.is_binary:
238 diff = _('binary file') + '\n'
241 diff = _('binary file') + '\n'
239 else:
242 else:
240 f_gitdiff = differ.get_gitdiff(filenode_old, node)
243 f_gitdiff = differ.get_gitdiff(filenode_old, node,
244 ignore_whitespace=ignore_whitespace)
241 diff = differ.DiffProcessor(f_gitdiff,
245 diff = differ.DiffProcessor(f_gitdiff,
242 format='gitdiff').raw_diff()
246 format='gitdiff').raw_diff()
243
247
@@ -250,7 +254,8 b' class ChangesetController(BaseRepoContro'
250 if filenode_old.is_binary or node.is_binary:
254 if filenode_old.is_binary or node.is_binary:
251 diff = _('binary file')
255 diff = _('binary file')
252 else:
256 else:
253 f_gitdiff = differ.get_gitdiff(filenode_old, node)
257 f_gitdiff = differ.get_gitdiff(filenode_old, node,
258 ignore_whitespace=ignore_whitespace)
254 diff = differ.DiffProcessor(f_gitdiff,
259 diff = differ.DiffProcessor(f_gitdiff,
255 format='gitdiff').raw_diff()
260 format='gitdiff').raw_diff()
256
261
@@ -404,6 +404,7 b' class FilesController(BaseRepoController'
404 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
404 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
405 'repository.admin')
405 'repository.admin')
406 def diff(self, repo_name, f_path):
406 def diff(self, repo_name, f_path):
407 ignore_whitespace = request.GET.get('ignorews') == '1'
407 diff1 = request.GET.get('diff1')
408 diff1 = request.GET.get('diff1')
408 diff2 = request.GET.get('diff2')
409 diff2 = request.GET.get('diff2')
409 c.action = request.GET.get('diff')
410 c.action = request.GET.get('diff')
@@ -430,8 +431,9 b' class FilesController(BaseRepoController'
430 repo_name=c.repo_name, f_path=f_path))
431 repo_name=c.repo_name, f_path=f_path))
431
432
432 if c.action == 'download':
433 if c.action == 'download':
433 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
434 _diff = differ.get_gitdiff(node1, node2,
434 format='gitdiff')
435 ignore_whitespace=ignore_whitespace)
436 diff = differ.DiffProcessor(_diff,format='gitdiff')
435
437
436 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
438 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
437 response.content_type = 'text/plain'
439 response.content_type = 'text/plain'
@@ -440,8 +442,9 b' class FilesController(BaseRepoController'
440 return diff.raw_diff()
442 return diff.raw_diff()
441
443
442 elif c.action == 'raw':
444 elif c.action == 'raw':
443 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
445 _diff = differ.get_gitdiff(node1, node2,
444 format='gitdiff')
446 ignore_whitespace=ignore_whitespace)
447 diff = differ.DiffProcessor(_diff,format='gitdiff')
445 response.content_type = 'text/plain'
448 response.content_type = 'text/plain'
446 return diff.raw_diff()
449 return diff.raw_diff()
447
450
@@ -453,8 +456,9 b' class FilesController(BaseRepoController'
453 c.cur_diff = ''
456 c.cur_diff = ''
454 c.big_diff = True
457 c.big_diff = True
455 else:
458 else:
456 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
459 _diff = differ.get_gitdiff(node1, node2,
457 format='gitdiff')
460 ignore_whitespace=ignore_whitespace)
461 diff = differ.DiffProcessor(_diff,format='gitdiff')
458 c.cur_diff = diff.as_html()
462 c.cur_diff = diff.as_html()
459 else:
463 else:
460
464
@@ -467,8 +471,9 b' class FilesController(BaseRepoController'
467 c.big_diff = True
471 c.big_diff = True
468
472
469 else:
473 else:
470 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
474 _diff = differ.get_gitdiff(node1, node2,
471 format='gitdiff')
475 ignore_whitespace=ignore_whitespace)
476 diff = differ.DiffProcessor(_diff,format='gitdiff')
472 c.cur_diff = diff.as_html()
477 c.cur_diff = diff.as_html()
473
478
474 if not c.cur_diff and not c.big_diff:
479 if not c.cur_diff and not c.big_diff:
General Comments 0
You need to be logged in to leave comments. Login now