mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
py3: add pycompat buffer alias
Summary: buffer in Python 2 became memoryview in Python 3. Reviewed By: quark-zju Differential Revision: D19717251 fbshipit-source-id: f678abfed7e2ec94053329b13015bff3c31eb319
This commit is contained in:
parent
e4b5247311
commit
66fd50346c
@ -327,7 +327,7 @@ class shallowcg1packer(changegroup.cg1packer):
|
||||
return results
|
||||
|
||||
def nodechunk(self, revlog, node, prevnode, linknode):
|
||||
prefix = ""
|
||||
prefix = b""
|
||||
if prevnode is not nullid and not revlog.candelta(prevnode, node):
|
||||
basenode = nullid
|
||||
else:
|
||||
@ -525,7 +525,7 @@ def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args):
|
||||
raise error.Abort("unexpected deltabase")
|
||||
base = reconstruct(f, deltabase)
|
||||
rawtext = mdiff.patch(base, delta)
|
||||
if isinstance(rawtext, buffer): # noqa
|
||||
if isinstance(rawtext, pycompat.buffer): # noqa
|
||||
rawtext = bytes(rawtext)
|
||||
return rawtext
|
||||
|
||||
|
@ -96,6 +96,7 @@ if sys.version_info[0] >= 3:
|
||||
|
||||
bytechr = chr
|
||||
bytestr = str
|
||||
buffer = memoryview
|
||||
|
||||
def raisewithtb(exc, tb):
|
||||
"""Raise exception with the given traceback"""
|
||||
@ -143,6 +144,7 @@ else:
|
||||
|
||||
bytechr = chr
|
||||
bytestr = str
|
||||
buffer = buffer
|
||||
range = xrange # noqa: F821
|
||||
unicode = unicode
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user