mercurial/revlog.py
changeset 16423 a150923b49ba
parent 16418 e5750c6716eb
child 16424 ff63d71ac8ab
--- a/mercurial/revlog.py	Fri Apr 13 22:55:46 2012 -0500
+++ b/mercurial/revlog.py	Thu Apr 12 20:26:33 2012 -0700
@@ -818,7 +818,7 @@
         df.close()
         self._addchunk(offset, d)
         if readahead > length:
-            return d[:length]
+            return util.buffer(d, 0, length)
         return d
 
     def _getchunk(self, offset, length):
@@ -831,7 +831,7 @@
         if cachestart >= 0 and cacheend <= l:
             if cachestart == 0 and cacheend == l:
                 return d # avoid a copy
-            return d[cachestart:cacheend]
+            return util.buffer(d, cachestart, cacheend - cachestart)
 
         return self._loadchunk(offset, length)
 
@@ -864,7 +864,7 @@
     def revdiff(self, rev1, rev2):
         """return or calculate a delta between two revisions"""
         if rev1 != nullrev and self.deltaparent(rev2) == rev1:
-            return self._chunk(rev2)
+            return str(self._chunk(rev2))
 
         return mdiff.textdiff(self.revision(self.node(rev1)),
                               self.revision(self.node(rev2)))
@@ -921,7 +921,7 @@
 
         self._chunkraw(base, rev)
         if text is None:
-            text = self._chunkbase(base)
+            text = str(self._chunkbase(base))
 
         bins = [self._chunk(r) for r in chain]
         text = mdiff.patches(text, bins)