# HG changeset patch
# User Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
# Date 2010-03-23 10:36:19
# Node ID cb681cc59a8da282f305457db2bd474e5daf256e
# Parent  53313405b54d25f0f30ae64f9df3d33a239cb559

util: fake the builtin buffer if it's missing (jython)

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -36,6 +36,13 @@ def _fastsha1(s):
     _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'