comparison hgext/fastannotate/protocol.py @ 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 f4733654f144
children
comparison
equal deleted inserted replaced
52390:e21485f51402 52391:6baf4c6ee14b
8 8
9 import contextlib 9 import contextlib
10 import os 10 import os
11 11
12 from mercurial.i18n import _ 12 from mercurial.i18n import _
13 from mercurial.pycompat import open
14 from mercurial import ( 13 from mercurial import (
15 error, 14 error,
16 extensions, 15 extensions,
17 hg, 16 hg,
18 util, 17 util,
82 # agree where the main branch is. 81 # agree where the main branch is.
83 if actx.lastnode != lastnode: 82 if actx.lastnode != lastnode:
84 for p in [actx.revmappath, actx.linelogpath]: 83 for p in [actx.revmappath, actx.linelogpath]:
85 if not os.path.exists(p): 84 if not os.path.exists(p):
86 continue 85 continue
87 with open(p, b'rb') as f: 86 with open(p, 'rb') as f:
88 content = f.read() 87 content = f.read()
89 vfsbaselen = len(repo.vfs.base + b'/') 88 vfsbaselen = len(repo.vfs.base + b'/')
90 relpath = p[vfsbaselen:] 89 relpath = p[vfsbaselen:]
91 result += b'%s\0%d\0%s' % (relpath, len(content), content) 90 result += b'%s\0%d\0%s' % (relpath, len(content), content)
92 return result 91 return result