mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
bdiff: (pure) support array.array arrays (issue5130)
This commit is contained in:
parent
a74c6e1e14
commit
156f8d111d
@ -7,6 +7,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import array
|
||||
import difflib
|
||||
import re
|
||||
import struct
|
||||
@ -50,9 +51,15 @@ def _normalizeblocks(a, b, blocks):
|
||||
r.append(prev)
|
||||
return r
|
||||
|
||||
def _tostring(c):
|
||||
if type(c) is array.array:
|
||||
# this copy overhead isn't ideal
|
||||
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)
|
||||
|
@ -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 ..
|
||||
|
Loading…
Reference in New Issue
Block a user