comparison mercurial/commands.py @ 50847:b922c767b214

cat: avoid round tripping **opts -> byteskwargs -> strkwargs Some internal users still want byteskwargs, so they are serviced in place. Once this pattern of changing types is eliminated everywhere, the remaining internal uses can be cleaned up individually (hopefully).
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 19 Aug 2023 22:56:14 -0400
parents 0ab3956540a6
children 489268c8ee7e
comparison
equal deleted inserted replaced
50846:3ccef7902070 50847:b922c767b214
1792 :data: String. File content. 1792 :data: String. File content.
1793 :path: String. Repository-absolute path of the file. 1793 :path: String. Repository-absolute path of the file.
1794 1794
1795 Returns 0 on success. 1795 Returns 0 on success.
1796 """ 1796 """
1797 opts = pycompat.byteskwargs(opts) 1797 rev = opts.get('rev')
1798 rev = opts.get(b'rev')
1799 if rev: 1798 if rev:
1800 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn') 1799 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
1801 ctx = logcmdutil.revsingle(repo, rev) 1800 ctx = logcmdutil.revsingle(repo, rev)
1802 m = scmutil.match(ctx, (file1,) + pats, opts) 1801 m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts))
1803 fntemplate = opts.pop(b'output', b'') 1802 fntemplate = opts.pop('output', b'')
1804 if cmdutil.isstdiofilename(fntemplate): 1803 if cmdutil.isstdiofilename(fntemplate):
1805 fntemplate = b'' 1804 fntemplate = b''
1806 1805
1807 if fntemplate: 1806 if fntemplate:
1808 fm = formatter.nullformatter(ui, b'cat', opts) 1807 fm = formatter.nullformatter(ui, b'cat', pycompat.byteskwargs(opts))
1809 else: 1808 else:
1810 ui.pager(b'cat') 1809 ui.pager(b'cat')
1811 fm = ui.formatter(b'cat', opts) 1810 fm = ui.formatter(b'cat', pycompat.byteskwargs(opts))
1812 with fm: 1811 with fm:
1813 return cmdutil.cat( 1812 return cmdutil.cat(ui, repo, ctx, m, fm, fntemplate, b'', **opts)
1814 ui, repo, ctx, m, fm, fntemplate, b'', **pycompat.strkwargs(opts)
1815 )
1816 1813
1817 1814
1818 @command( 1815 @command(
1819 b'clone', 1816 b'clone',
1820 [ 1817 [