# HG changeset patch # User Ronny Pfannschmidt # Date 1269340579 -3600 # Node ID cb681cc59a8da282f305457db2bd474e5daf256e # Parent 53313405b54d25f0f30ae64f9df3d33a239cb559 util: fake the builtin buffer if it's missing (jython) diff -r 53313405b54d -r cb681cc59a8d mercurial/util.py --- a/mercurial/util.py Mon Mar 22 11:08:52 2010 +0100 +++ b/mercurial/util.py Tue Mar 23 11:36:19 2010 +0100 @@ -36,6 +36,13 @@ _fastsha1 = sha1 = _sha1 return _sha1(s) +import __builtin__ + +def fakebuffer(sliceable, offset=0): + return sliceable[offset:] +if not hasattr(__builtin__, 'buffer'): + __builtin__.buffer = fakebuffer + import subprocess closefds = os.name == 'posix'