Changeset - f3402cb92fdf
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-02-14 16:43:57
marcin@python-works.com
changed raw and download diffs to gitdiff
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -204,34 +204,38 @@ class FilesController(BaseController):
 
                c.changeset_2 = EmptyChangeset()
 
                node2 = FileNode('.', '', changeset=c.changeset_2)
 
        except RepositoryError:
 
            return redirect(url('files_home',
 
                                repo_name=c.repo_name, f_path=f_path))
 

	
 
        f_udiff = differ.get_udiff(node1, node2)
 
        diff = differ.DiffProcessor(f_udiff)
 

	
 
        if c.action == 'download':
 
            diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2))
 

	
 
            diff_name = '%s_vs_%s.diff' % (diff1, diff2)
 
            response.content_type = 'text/plain'
 
            response.content_disposition = 'attachment; filename=%s' \
 
                                                    % diff_name
 
            return diff.raw_diff()
 

	
 
        elif c.action == 'raw':
 
            diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2))
 
            response.content_type = 'text/plain'
 
            return diff.raw_diff()
 

	
 
        elif c.action == 'diff':
 
            diff = differ.DiffProcessor(differ.get_udiff(node1, node2))
 

	
 
            if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
 
                c.cur_diff = _('Diff is to big to display')
 
            elif node1.is_binary or node2.is_binary:
 
                c.cur_diff = _('Binary file')
 
            else:
 
                c.cur_diff = diff.as_html()
 
        else:
 
            diff = differ.DiffProcessor(differ.get_udiff(node1, node2))
 
            #default option
 
            if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
 
                c.cur_diff = _('Diff is to big to display')
 
            elif node1.is_binary or node2.is_binary:
 
                c.cur_diff = _('Binary file')
 
            else:
0 comments (0 inline, 0 general)