# HG changeset patch # User Marcin Kuzminski # Date 2011-12-03 19:00:36 # Node ID f28dc032adf0117124473fe2ab10bc16333eae32 # Parent 47c2a006d43b7390929aa655e5df3cfae1507243 Added handling of ignore whitespace flag in changesets - fixed messages for FK validation diff --git a/rhodecode/controllers/admin/repos.py b/rhodecode/controllers/admin/repos.py --- a/rhodecode/controllers/admin/repos.py +++ b/rhodecode/controllers/admin/repos.py @@ -254,7 +254,7 @@ class ReposController(BaseController): h.flash(_('deleted repository %s') % repo_name, category='success') Session.commit() except IntegrityError, e: - if e.message.find('repositories_fork_id_fkey'): + if e.message.find('repositories_fork_id_fkey') != -1: log.error(traceback.format_exc()) h.flash(_('Cannot delete %s it still contains attached ' 'forks') % repo_name, diff --git a/rhodecode/controllers/admin/repos_groups.py b/rhodecode/controllers/admin/repos_groups.py --- a/rhodecode/controllers/admin/repos_groups.py +++ b/rhodecode/controllers/admin/repos_groups.py @@ -162,7 +162,7 @@ class ReposGroupsController(BaseControll h.flash(_('removed repos group %s' % gr.group_name), category='success') #TODO: in future action_logger(, '', '', '', self.sa) except IntegrityError, e: - if e.message.find('groups_group_parent_id_fkey'): + if e.message.find('groups_group_parent_id_fkey') != -1: log.error(traceback.format_exc()) h.flash(_('Cannot delete this group it still contains ' 'subgroups'), diff --git a/rhodecode/controllers/changeset.py b/rhodecode/controllers/changeset.py --- a/rhodecode/controllers/changeset.py +++ b/rhodecode/controllers/changeset.py @@ -59,7 +59,7 @@ class ChangesetController(BaseRepoContro c.affected_files_cut_off = 60 def index(self, revision): - + ignore_whitespace = request.GET.get('ignorews') == '1' def wrap_to_table(str): return ''' @@ -130,7 +130,8 @@ class ChangesetController(BaseRepoContro # made c.sum_added += node.size if c.sum_added < self.cut_off_limit: - f_gitdiff = differ.get_gitdiff(filenode_old, node) + f_gitdiff = differ.get_gitdiff(filenode_old, node, + ignore_whitespace=ignore_whitespace) d = differ.DiffProcessor(f_gitdiff, format='gitdiff') st = d.stat() @@ -168,7 +169,8 @@ class ChangesetController(BaseRepoContro else: if c.sum_removed < self.cut_off_limit: - f_gitdiff = differ.get_gitdiff(filenode_old, node) + f_gitdiff = differ.get_gitdiff(filenode_old, node, + ignore_whitespace=ignore_whitespace) d = differ.DiffProcessor(f_gitdiff, format='gitdiff') st = d.stat() @@ -219,6 +221,7 @@ class ChangesetController(BaseRepoContro def raw_changeset(self, revision): method = request.GET.get('diff', 'show') + ignore_whitespace = request.GET.get('ignorews') == '1' try: c.scm_type = c.rhodecode_repo.alias c.changeset = c.rhodecode_repo.get_changeset(revision) @@ -237,7 +240,8 @@ class ChangesetController(BaseRepoContro if filenode_old.is_binary or node.is_binary: diff = _('binary file') + '\n' else: - f_gitdiff = differ.get_gitdiff(filenode_old, node) + f_gitdiff = differ.get_gitdiff(filenode_old, node, + ignore_whitespace=ignore_whitespace) diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').raw_diff() @@ -250,7 +254,8 @@ class ChangesetController(BaseRepoContro if filenode_old.is_binary or node.is_binary: diff = _('binary file') else: - f_gitdiff = differ.get_gitdiff(filenode_old, node) + f_gitdiff = differ.get_gitdiff(filenode_old, node, + ignore_whitespace=ignore_whitespace) diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').raw_diff() diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -404,6 +404,7 @@ class FilesController(BaseRepoController @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin') def diff(self, repo_name, f_path): + ignore_whitespace = request.GET.get('ignorews') == '1' diff1 = request.GET.get('diff1') diff2 = request.GET.get('diff2') c.action = request.GET.get('diff') @@ -430,8 +431,9 @@ class FilesController(BaseRepoController repo_name=c.repo_name, f_path=f_path)) if c.action == 'download': - diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2), - format='gitdiff') + _diff = differ.get_gitdiff(node1, node2, + ignore_whitespace=ignore_whitespace) + diff = differ.DiffProcessor(_diff,format='gitdiff') diff_name = '%s_vs_%s.diff' % (diff1, diff2) response.content_type = 'text/plain' @@ -440,8 +442,9 @@ class FilesController(BaseRepoController return diff.raw_diff() elif c.action == 'raw': - diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2), - format='gitdiff') + _diff = differ.get_gitdiff(node1, node2, + ignore_whitespace=ignore_whitespace) + diff = differ.DiffProcessor(_diff,format='gitdiff') response.content_type = 'text/plain' return diff.raw_diff() @@ -453,8 +456,9 @@ class FilesController(BaseRepoController c.cur_diff = '' c.big_diff = True else: - diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2), - format='gitdiff') + _diff = differ.get_gitdiff(node1, node2, + ignore_whitespace=ignore_whitespace) + diff = differ.DiffProcessor(_diff,format='gitdiff') c.cur_diff = diff.as_html() else: @@ -467,8 +471,9 @@ class FilesController(BaseRepoController c.big_diff = True else: - diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2), - format='gitdiff') + _diff = differ.get_gitdiff(node1, node2, + ignore_whitespace=ignore_whitespace) + diff = differ.DiffProcessor(_diff,format='gitdiff') c.cur_diff = diff.as_html() if not c.cur_diff and not c.big_diff: