Patchwork [2,of,7] py3: use bytes() to cast to immutable bytes in pure.bdiff.bdiff()

login
register
mail settings
Submitter Yuya Nishihara
Date March 26, 2017, 11:59 a.m.
Message ID <662b30cb4977b4f6fcf5.1490529585@mimosa>
Download mbox | patch
Permalink /patch/19679/
State Accepted
Headers show

Comments

Yuya Nishihara - March 26, 2017, 11:59 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1490512605 -32400
#      Sun Mar 26 16:16:45 2017 +0900
# Node ID 662b30cb4977b4f6fcf56e768ef1c7c5da8e8adc
# Parent  3bb6534a49672073885c64a7a75a8ef5bb26f381
py3: use bytes() to cast to immutable bytes in pure.bdiff.bdiff()

Patch

diff --git a/mercurial/pure/bdiff.py b/mercurial/pure/bdiff.py
--- a/mercurial/pure/bdiff.py
+++ b/mercurial/pure/bdiff.py
@@ -54,12 +54,9 @@  def _normalizeblocks(a, b, blocks):
     r.append(prev)
     return r
 
-def _tostring(c):
-    return str(c)
-
 def bdiff(a, b):
-    a = _tostring(a).splitlines(True)
-    b = _tostring(b).splitlines(True)
+    a = bytes(a).splitlines(True)
+    b = bytes(b).splitlines(True)
 
     if not a:
         s = "".join(b)