Mercurial > public > mercurial-scm > hg
changeset 52391:6baf4c6ee14b
fastannotate: stop using the `pycompat.open()` shim
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 05 Dec 2024 13:11:41 -0500 |
parents | e21485f51402 |
children | 4c70a70a9bcd |
files | hgext/fastannotate/protocol.py hgext/fastannotate/revmap.py |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fastannotate/protocol.py Thu Dec 05 13:10:17 2024 -0500 +++ b/hgext/fastannotate/protocol.py Thu Dec 05 13:11:41 2024 -0500 @@ -10,7 +10,6 @@ import os from mercurial.i18n import _ -from mercurial.pycompat import open from mercurial import ( error, extensions, @@ -84,7 +83,7 @@ for p in [actx.revmappath, actx.linelogpath]: if not os.path.exists(p): continue - with open(p, b'rb') as f: + with open(p, 'rb') as f: content = f.read() vfsbaselen = len(repo.vfs.base + b'/') relpath = p[vfsbaselen:]
--- a/hgext/fastannotate/revmap.py Thu Dec 05 13:10:17 2024 -0500 +++ b/hgext/fastannotate/revmap.py Thu Dec 05 13:11:41 2024 -0500 @@ -13,7 +13,6 @@ import struct from mercurial.node import hex -from mercurial.pycompat import open from mercurial import ( error as hgerror, ) @@ -163,12 +162,12 @@ if not self.path: return if self._lastmaxrev == -1: # write the entire file - with open(self.path, b'wb') as f: + with open(self.path, 'wb') as f: f.write(self.HEADER) for i in range(1, len(self._rev2hsh)): self._writerev(i, f) else: # append incrementally - with open(self.path, b'ab') as f: + with open(self.path, 'ab') as f: for i in range(self._lastmaxrev + 1, len(self._rev2hsh)): self._writerev(i, f) self._lastmaxrev = self.maxrev @@ -181,7 +180,7 @@ # which is faster than both LOAD_CONST and LOAD_GLOBAL. flaglen = 1 hshlen = _hshlen - with open(self.path, b'rb') as f: + with open(self.path, 'rb') as f: if f.read(len(self.HEADER)) != self.HEADER: raise error.CorruptedFileError() self.clear(flush=False) @@ -251,7 +250,7 @@ """ hsh = None try: - with open(path, b'rb') as f: + with open(path, 'rb') as f: f.seek(-_hshlen, io.SEEK_END) if f.tell() > len(revmap.HEADER): hsh = f.read(_hshlen)