[PATCH 03 of 13] Initial attempt to update the 'buffer' calls with 'memoryview' on Py3k

Alejandro Santos alejolp at alejolp.com
Wed Aug 5 15:55:37 CDT 2009


# HG changeset patch
# User Alejandro Santos <alejolp at alejolp.com>
# Date 1249486789 10800
# Node ID 34f746c2c5229c19a3adf7a475b34f9ddafa1772
# Parent  0980e0b497e4f788d31504f78583db3835b6c047
Initial attempt to update the 'buffer' calls with 'memoryview' on Py3k.

diff -r 0980e0b497e4 -r 34f746c2c522 mercurial/manifest.py
--- a/mercurial/manifest.py	Wed Aug 05 12:39:49 2009 -0300
+++ b/mercurial/manifest.py	Wed Aug 05 12:39:49 2009 -0300
@@ -6,7 +6,7 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import mdiff, parsers, error, revlog
+import mdiff, parsers, error, revlog, util
 import array, struct
 
 class manifestdict(dict):
@@ -156,7 +156,7 @@
             dline = [""]
             start = 0
             # zero copy representation of addlist as a buffer
-            addbuf = buffer(addlist)
+            addbuf = util.buffer(addlist)
 
             # start with a readonly loop that finds the offset of
             # each line and creates the deltas
@@ -194,7 +194,7 @@
                 cachedelta = None
             self.listcache = addlist
 
-        n = self.addrevision(buffer(self.listcache), transaction, link,
+        n = self.addrevision(util.buffer(self.listcache), transaction, link,
                              p1, p2, cachedelta)
         self.mapcache = (n, map)
 
diff -r 0980e0b497e4 -r 34f746c2c522 mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Aug 05 12:39:49 2009 -0300
+++ b/mercurial/revlog.py	Wed Aug 05 12:39:49 2009 -0300
@@ -1214,7 +1214,7 @@
                     # this can happen if two branches make the same change
                     chain = node
                     continue
-                delta = buffer(chunk, 80)
+                delta = util.buffer(chunk, 80)
                 del chunk
 
                 for p in (p1, p2):
@@ -1246,7 +1246,7 @@
                     text = self.revision(chain)
                     if len(text) == 0:
                         # skip over trivial delta header
-                        text = buffer(delta, 12)
+                        text = util.buffer(delta, 12)
                     else:
                         text = mdiff.patches(text, [delta])
                     del delta


More information about the Mercurial-devel mailing list