comparison mercurial/debugcommands.py @ 50972:206d7fad2a1c

debugpickmergetool: migrate `opts` to native kwargs
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 21 Aug 2023 17:31:53 -0400
parents 1e2be2c9a74d
children a0fcdcc53618
comparison
equal deleted inserted replaced
50971:1e2be2c9a74d 50972:206d7fad2a1c
3006 If merge tool is chosen before matching against 3006 If merge tool is chosen before matching against
3007 ``merge-patterns``, this command can't show any helpful 3007 ``merge-patterns``, this command can't show any helpful
3008 information, even with --debug. In such case, information above is 3008 information, even with --debug. In such case, information above is
3009 useful to know why a merge tool is chosen. 3009 useful to know why a merge tool is chosen.
3010 """ 3010 """
3011 opts = pycompat.byteskwargs(opts)
3012 overrides = {} 3011 overrides = {}
3013 if opts[b'tool']: 3012 if opts['tool']:
3014 overrides[(b'ui', b'forcemerge')] = opts[b'tool'] 3013 overrides[(b'ui', b'forcemerge')] = opts['tool']
3015 ui.notenoi18n(b'with --tool %r\n' % (pycompat.bytestr(opts[b'tool']))) 3014 ui.notenoi18n(b'with --tool %r\n' % (pycompat.bytestr(opts['tool'])))
3016 3015
3017 with ui.configoverride(overrides, b'debugmergepatterns'): 3016 with ui.configoverride(overrides, b'debugmergepatterns'):
3018 hgmerge = encoding.environ.get(b"HGMERGE") 3017 hgmerge = encoding.environ.get(b"HGMERGE")
3019 if hgmerge is not None: 3018 if hgmerge is not None:
3020 ui.notenoi18n(b'with HGMERGE=%r\n' % (pycompat.bytestr(hgmerge))) 3019 ui.notenoi18n(b'with HGMERGE=%r\n' % (pycompat.bytestr(hgmerge)))
3021 uimerge = ui.config(b"ui", b"merge") 3020 uimerge = ui.config(b"ui", b"merge")
3022 if uimerge: 3021 if uimerge:
3023 ui.notenoi18n(b'with ui.merge=%r\n' % (pycompat.bytestr(uimerge))) 3022 ui.notenoi18n(b'with ui.merge=%r\n' % (pycompat.bytestr(uimerge)))
3024 3023
3025 ctx = scmutil.revsingle(repo, opts.get(b'rev')) 3024 ctx = scmutil.revsingle(repo, opts.get('rev'))
3026 m = scmutil.match(ctx, pats, opts) 3025 m = scmutil.match(ctx, pats, pycompat.byteskwargs(opts))
3027 changedelete = opts[b'changedelete'] 3026 changedelete = opts['changedelete']
3028 for path in ctx.walk(m): 3027 for path in ctx.walk(m):
3029 fctx = ctx[path] 3028 fctx = ctx[path]
3030 with ui.silent( 3029 with ui.silent(
3031 error=True 3030 error=True
3032 ) if not ui.debugflag else util.nullcontextmanager(): 3031 ) if not ui.debugflag else util.nullcontextmanager():