Patchwork [7,of,9,py3,v2] branchmap: don't use buffer() on Python 3

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 5:38 p.m.
Message ID <5295e63c3fa2fd37c473.1489340301@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19185/
State Superseded
Headers show

Comments

Augie Fackler - March 12, 2017, 5:38 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489297759 18000
#      Sun Mar 12 00:49:19 2017 -0500
# Node ID 5295e63c3fa2fd37c4736c69e6caeb573ccaced5
# Parent  b9d20b6e86e011db2a11abccc26250c7a83e8aac
branchmap: don't use buffer() on Python 3

This is certainly slower than the Python 2 code, but it works, and we
can revisit it later if it's a problem.

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -409,7 +409,7 @@  class revbranchcache(object):
         # fast path: extract data from cache, use it if node is matching
         reponode = changelog.node(rev)[:_rbcnodelen]
         cachenode, branchidx = unpack(
-            _rbcrecfmt, buffer(self._rbcrevs, rbcrevidx, _rbcrecsize))
+            _rbcrecfmt, util.buffer(self._rbcrevs, rbcrevidx, _rbcrecsize))
         close = bool(branchidx & _rbccloseflag)
         if close:
             branchidx &= _rbcbranchidxmask