示例#1
0
def unicode_make_patch(old_text, new_text):
    """ Helper wrapper around make_patch() which takes unicode strings."""
    values = compress(mdiff.textdiff(old_text.encode('utf8'),
                                     new_text.encode('utf8')))
    if values[0]:
        return ''.join(values)

    return values[1]
示例#2
0
def make_patch(old_text, new_text):
    """ Return a raw patch bytes which transforms old_text into new_text. """
    values = compress(mdiff.textdiff(old_text, new_text))
    if values[0]:
        return ''.join(values)
    return values[1]