Changeset - ce4287e3e3c9
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 15 years ago 2011-03-10 23:21:16
marcin@python-works.com
changed all instances of udiff into gitdiff, for vcs issue #49
2 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/changeset.py
Show inline comments
 
@@ -97,51 +97,51 @@ class ChangesetController(BaseRepoContro
 

	
 

	
 
            #==================================================================
 
            # ADDED FILES
 
            #==================================================================
 
            for node in changeset.added:
 
                filenode_old = FileNode(node.path, '', EmptyChangeset())
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = wrap_to_table(_('binary file'))
 
                else:
 
                    c.sum_added += node.size
 
                    if c.sum_added < self.cut_off_limit:
 
                        f_udiff = differ.get_udiff(filenode_old, node)
 
                        diff = differ.DiffProcessor(f_udiff).as_html()
 
                        f_gitdiff = differ.get_gitdiff(filenode_old, node)
 
                        diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').as_html()
 

	
 
                    else:
 
                        diff = wrap_to_table(_('Changeset is to big and was cut'
 
                                            ' off, see raw changeset instead'))
 

	
 
                cs1 = None
 
                cs2 = node.last_changeset.raw_id
 
                c.changes[changeset.raw_id].append(('added', node, diff, cs1, cs2))
 

	
 
            #==================================================================
 
            # CHANGED FILES
 
            #==================================================================
 
            for node in changeset.changed:
 
                try:
 
                    filenode_old = changeset_parent.get_node(node.path)
 
                except ChangesetError:
 
                    filenode_old = FileNode(node.path, '', EmptyChangeset())
 

	
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = wrap_to_table(_('binary file'))
 
                else:
 

	
 
                    if c.sum_removed < self.cut_off_limit:
 
                        f_udiff = differ.get_udiff(filenode_old, node)
 
                        diff = differ.DiffProcessor(f_udiff).as_html()
 
                        f_gitdiff = differ.get_gitdiff(filenode_old, node)
 
                        diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').as_html()
 
                        if diff:
 
                            c.sum_removed += len(diff)
 
                    else:
 
                        diff = wrap_to_table(_('Changeset is to big and was cut'
 
                                            ' off, see raw changeset instead'))
 

	
 

	
 
                cs1 = filenode_old.last_changeset.raw_id
 
                cs2 = node.last_changeset.raw_id
 
                c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2))
 

	
 
            #==================================================================
 
@@ -170,38 +170,38 @@ class ChangesetController(BaseRepoContro
 
        else:
 
            try:
 
                c.changeset_parent = c.changeset.parents[0]
 
            except IndexError:
 
                c.changeset_parent = None
 
            c.changes = []
 

	
 
            for node in c.changeset.added:
 
                filenode_old = FileNode(node.path, '')
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = _('binary file') + '\n'
 
                else:
 
                    f_udiff = differ.get_gitdiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_udiff).raw_diff()
 
                    f_gitdiff = differ.get_gitdiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_gitdiff).raw_diff()
 

	
 
                cs1 = None
 
                cs2 = node.last_changeset.raw_id
 
                c.changes.append(('added', node, diff, cs1, cs2))
 

	
 
            for node in c.changeset.changed:
 
                filenode_old = c.changeset_parent.get_node(node.path)
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = _('binary file')
 
                else:
 
                    f_udiff = differ.get_gitdiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_udiff).raw_diff()
 
                    f_gitdiff = differ.get_gitdiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_gitdiff).raw_diff()
 

	
 
                cs1 = filenode_old.last_changeset.raw_id
 
                cs2 = node.last_changeset.raw_id
 
                c.changes.append(('changed', node, diff, cs1, cs2))
 

	
 
        response.content_type = 'text/plain'
 

	
 
        if method == 'download':
 
            response.content_disposition = 'attachment; filename=%s.patch' % revision
 

	
 
        parent = True if len(c.changeset.parents) > 0 else False
 
        c.parent_tmpl = 'Parent  %s' % c.changeset.parents[0].raw_id if parent else ''
rhodecode/controllers/files.py
Show inline comments
 
@@ -233,34 +233,34 @@ class FilesController(BaseRepoController
 
            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))
 
            diff = differ.DiffProcessor(differ.get_gitdiff(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))
 
            diff = differ.DiffProcessor(differ.get_gitdiff(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:
 
                c.cur_diff = diff.as_html()
 

	
 
        if not c.cur_diff: c.no_changes = True
 
        return render('files/file_diff.html')
 

	
 
    def _get_history(self, repo, node, f_path):
0 comments (0 inline, 0 general)