comparison mercurial/cmdutil.py @ 52402:00f5966f0483

cmdutil: stop using the `pycompat.open()` shim Somewhat dubious I suppose, but maybe it makes sense to use the type checking system to more aggressively use str for trivial things like the `mode` argument to the function that calls this. That's a project for another day.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 04 Dec 2024 21:09:12 -0500
parents f4733654f144
children 9d79ffeed7c0
comparison
equal deleted inserted replaced
52401:535a1e686d7f 52402:00f5966f0483
27 from .i18n import _ 27 from .i18n import _
28 from .node import ( 28 from .node import (
29 hex, 29 hex,
30 nullrev, 30 nullrev,
31 short, 31 short,
32 )
33 from .pycompat import (
34 open,
35 ) 32 )
36 from .thirdparty import attr 33 from .thirdparty import attr
37 34
38 # Force pytype to use the non-vendored package 35 # Force pytype to use the non-vendored package
39 if typing.TYPE_CHECKING: 36 if typing.TYPE_CHECKING:
1404 fp = repo.ui.fout 1401 fp = repo.ui.fout
1405 else: 1402 else:
1406 fp = repo.ui.fin 1403 fp = repo.ui.fin
1407 return _unclosablefile(fp) 1404 return _unclosablefile(fp)
1408 fn = makefilename(ctx, pat, **props) 1405 fn = makefilename(ctx, pat, **props)
1409 return open(fn, mode) 1406 return open(fn, pycompat.sysstr(mode))
1410 1407
1411 1408
1412 def openstorage(repo, cmd, file_, opts, returnrevlog=False): 1409 def openstorage(repo, cmd, file_, opts, returnrevlog=False):
1413 """opens the changelog, manifest, a filelog or a given revlog""" 1410 """opens the changelog, manifest, a filelog or a given revlog"""
1414 cl = opts[b'changelog'] 1411 cl = opts[b'changelog']