revlog: fix caching of buffer objects
authorMatt Mackall <mpm@selenic.com>
Thu, 11 Oct 2007 00:46:53 -0500
changeset 5450 c728424d44c6
parent 5449 17a4b20eda7b
child 5451 0a43875677b1
revlog: fix caching of buffer objects
mercurial/changelog.py
mercurial/revlog.py
mercurial/util.py
--- a/mercurial/changelog.py	Thu Oct 11 00:46:52 2007 -0500
+++ b/mercurial/changelog.py	Thu Oct 11 00:46:53 2007 -0500
@@ -74,7 +74,7 @@
         return ret
 
     def write(self, s):
-        self.data.append(s)
+        self.data.append(str(s))
         self.offset += len(s)
 
 class changelog(revlog):
--- a/mercurial/revlog.py	Thu Oct 11 00:46:52 2007 -0500
+++ b/mercurial/revlog.py	Thu Oct 11 00:46:53 2007 -0500
@@ -903,7 +903,7 @@
         if node == nullid:
             return ""
         if self._cache and self._cache[0] == node:
-            return self._cache[2]
+            return str(self._cache[2])
 
         # look up what we need to read
         text = None
@@ -924,7 +924,7 @@
         # do we have useful data cached?
         if self._cache and self._cache[1] >= base and self._cache[1] < rev:
             base = self._cache[1]
-            text = self._cache[2]
+            text = str(self._cache[2])
             self._loadindex(base, rev + 1)
         else:
             self._loadindex(base, rev + 1)
--- a/mercurial/util.py	Thu Oct 11 00:46:52 2007 -0500
+++ b/mercurial/util.py	Thu Oct 11 00:46:53 2007 -0500
@@ -1421,7 +1421,7 @@
                 self.iter = False
             self.buf = collector.getvalue()
         if len(self.buf) == l:
-            s, self.buf = self.buf, ''
+            s, self.buf = str(self.buf), ''
         else:
             s, self.buf = self.buf[:l], buffer(self.buf, l)
         return s