Mercurial > public > mercurial-scm > hg
diff mercurial/manifest.py @ 31346:2a18e9e6ca43
py3: use bytearray() instead of array('c', ...) constructions
Portable from 2.6-3.6.
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 12 Mar 2017 03:32:21 -0400 |
parents | c134a33b1d73 |
children | 667e88568087 |
line wrap: on
line diff
--- a/mercurial/manifest.py Sat Mar 11 20:58:26 2017 -0500 +++ b/mercurial/manifest.py Sun Mar 12 03:32:21 2017 -0400 @@ -7,7 +7,6 @@ from __future__ import absolute_import -import array import heapq import os import struct @@ -628,8 +627,9 @@ else: # For large changes, it's much cheaper to just build the text and # diff it. - arraytext = array.array('c', self.text()) - deltatext = mdiff.textdiff(base, arraytext) + arraytext = bytearray(self.text()) + deltatext = mdiff.textdiff( + util.buffer(base), util.buffer(arraytext)) return arraytext, deltatext @@ -687,12 +687,12 @@ # for large addlist arrays, building a new array is cheaper # than repeatedly modifying the existing one currentposition = 0 - newaddlist = array.array('c') + newaddlist = bytearray() for start, end, content in x: newaddlist += addlist[currentposition:start] if content: - newaddlist += array.array('c', content) + newaddlist += bytearray(content) currentposition = end @@ -1240,7 +1240,7 @@ else: text = m.text(self._usemanifestv2) n = self.addrevision(text, transaction, link, p1, p2) - arraytext = array.array('c', text) + arraytext = bytearray(text) if arraytext is not None: self.fulltextcache[n] = arraytext @@ -1420,7 +1420,7 @@ else: rl = self._revlog() text = rl.revision(self._node) - arraytext = array.array('c', text) + arraytext = bytearray(text) rl._fulltextcache[self._node] = arraytext self._data = manifestdict(text) return self._data @@ -1529,7 +1529,7 @@ self._data = m else: text = rl.revision(self._node) - arraytext = array.array('c', text) + arraytext = bytearray(text) rl.fulltextcache[self._node] = arraytext self._data = treemanifest(dir=self._dir, text=text)