[PATCH STABLE] bdiff: (pure) support array.array arrays (issue5130)
timeless
timeless at mozdev.org
Tue Mar 8 17:28:11 UTC 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1457457972 0
# Tue Mar 08 17:26:12 2016 +0000
# Branch stable
# Node ID 5d69a2ef233c74a13d584679bbbb6200a3904441
# Parent 8949d73b2e1f5c0b9c4c6c195bef2fe284349c6e
bdiff: (pure) support array.array arrays (issue5130)
diff --git a/mercurial/pure/bdiff.py b/mercurial/pure/bdiff.py
--- a/mercurial/pure/bdiff.py
+++ b/mercurial/pure/bdiff.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import
+import array
import difflib
import re
import struct
@@ -50,9 +51,14 @@
r.append(prev)
return r
+def _tostring(c):
+ if type(c) is array.array:
+ return c.tostring()
+ return str(c)
+
def bdiff(a, b):
- a = str(a).splitlines(True)
- b = str(b).splitlines(True)
+ a = _tostring(a).splitlines(True)
+ b = _tostring(b).splitlines(True)
if not a:
s = "".join(b)
diff --git a/tests/test-clone-uncompressed.t b/tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -1,5 +1,8 @@
#require serve
+Initialize repository
+the status call is to check for issue5130
+
$ hg init server
$ cd server
$ touch foo
@@ -8,6 +11,7 @@
... with open(str(i), 'wb') as fh:
... fh.write(str(i))
$ hg -q commit -A -m 'add a lot of files'
+ $ hg st
$ hg serve -p $HGPORT -d --pid-file=hg.pid
$ cat hg.pid >> $DAEMON_PIDS
$ cd ..
More information about the Mercurial-devel
mailing list