Changeset - ab75def5c15d
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-09-16 20:04:23
marcin@python-works.com
fixes #567 diff non-unicode encoding missmatch
- now uses safe_unicode ass all other parts of the system
2 files changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/diffs.py
Show inline comments
 
@@ -41,12 +41,13 @@ from rhodecode.lib.compat import BytesIO
 
from rhodecode.lib.vcs.utils.hgcompat import localrepo
 
from rhodecode.lib.vcs.exceptions import VCSError
 
from rhodecode.lib.vcs.nodes import FileNode, SubModuleNode
 
from rhodecode.lib.vcs.backends.base import EmptyChangeset
 
from rhodecode.lib.helpers import escape
 
from rhodecode.lib.utils import make_ui
 
from rhodecode.lib.utils2 import safe_unicode
 

	
 

	
 
def wrap_to_table(str_):
 
    return '''<table class="code-difftable">
 
                <tr class="line no-comment">
 
                <td class="lineno new"></td>
 
@@ -211,13 +212,13 @@ class DiffProcessor(object):
 
    def _parse_gitdiff(self, diffiterator):
 
        def line_decoder(l):
 
            if l.startswith('+') and not l.startswith('+++'):
 
                self.adds += 1
 
            elif l.startswith('-') and not l.startswith('---'):
 
                self.removes += 1
 
            return l.decode('utf8', 'replace')
 
            return safe_unicode(l)
 

	
 
        output = list(diffiterator)
 
        size = len(output)
 

	
 
        if size == 2:
 
            l = []
rhodecode/lib/vcs/utils/diffs.py
Show inline comments
 
@@ -10,12 +10,13 @@ from difflib import unified_diff
 
from itertools import tee, imap
 

	
 
from mercurial.match import match
 

	
 
from rhodecode.lib.vcs.exceptions import VCSError
 
from rhodecode.lib.vcs.nodes import FileNode, NodeError
 
from rhodecode.lib.vcs.utils import safe_unicode
 

	
 

	
 
def get_udiff(filenode_old, filenode_new, show_whitespace=True):
 
    """
 
    Returns unified diff between given ``filenode_old`` and ``filenode_new``.
 
    """
 
@@ -146,13 +147,13 @@ class DiffProcessor(object):
 
    def _parse_gitdiff(self, diffiterator):
 
        def line_decoder(l):
 
            if l.startswith('+') and not l.startswith('+++'):
 
                self.adds += 1
 
            elif l.startswith('-') and not l.startswith('---'):
 
                self.removes += 1
 
            return l.decode('utf8', 'replace')
 
            return safe_unicode(l)
 

	
 
        output = list(diffiterator)
 
        size = len(output)
 

	
 
        if size == 2:
 
            l = []
0 comments (0 inline, 0 general)