Mercurial > hg
changeset 36400:7b86aa31b004
py3: fix handling of keyword arguments at more places
The keys of keyword arguments of Python 3 should be str, which is why we need to
prevent getting the b'' prefix added by the transformer or convert keys to str
using pycompat.strkwargs()
Differential Revision: https://phab.mercurial-scm.org/D2420
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 24 Feb 2018 16:18:40 +0530 |
parents | a24c57f1f5c3 |
children | d65642840c6f |
files | hgext/largefiles/overrides.py hgext/lfs/__init__.py hgext/rebase.py hgext/split.py mercurial/localrepo.py mercurial/profiling.py |
diffstat | 6 files changed, 14 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Sat Feb 24 16:16:14 2018 +0530 +++ b/hgext/largefiles/overrides.py Sat Feb 24 16:18:40 2018 +0530 @@ -824,7 +824,7 @@ """Override push command and store --lfrev parameters in opargs""" lfrevs = kwargs.pop(r'lfrev', None) if lfrevs: - opargs = kwargs.setdefault('opargs', {}) + opargs = kwargs.setdefault(r'opargs', {}) opargs['lfrevs'] = scmutil.revrange(repo, lfrevs) return orig(ui, repo, *args, **kwargs)
--- a/hgext/lfs/__init__.py Sat Feb 24 16:16:14 2018 +0530 +++ b/hgext/lfs/__init__.py Sat Feb 24 16:18:40 2018 +0530 @@ -220,12 +220,12 @@ if 'lfs' not in repo.requirements: def checkrequireslfs(ui, repo, **kwargs): if 'lfs' not in repo.requirements: - last = kwargs.get('node_last') + last = kwargs.get(r'node_last') _bin = node.bin if last: - s = repo.set('%n:%n', _bin(kwargs['node']), _bin(last)) + s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) else: - s = repo.set('%n', _bin(kwargs['node'])) + s = repo.set('%n', _bin(kwargs[r'node'])) for ctx in s: # TODO: is there a way to just walk the files in the commit? if any(ctx[f].islfs() for f in ctx.files() if f in ctx):
--- a/hgext/rebase.py Sat Feb 24 16:16:14 2018 +0530 +++ b/hgext/rebase.py Sat Feb 24 16:18:40 2018 +0530 @@ -593,7 +593,8 @@ self.state[oldrev] = newrev if 'qtip' in repo.tags(): - updatemq(repo, self.state, self.skipped, **opts) + updatemq(repo, self.state, self.skipped, + **pycompat.strkwargs(opts)) # restore original working directory # (we do this before stripping)
--- a/hgext/split.py Sat Feb 24 16:16:14 2018 +0530 +++ b/hgext/split.py Sat Feb 24 16:18:40 2018 +0530 @@ -24,6 +24,7 @@ hg, obsolete, phases, + pycompat, registrar, revsetlang, scmutil, @@ -160,7 +161,7 @@ 'interactive': True, 'message': header + ctx.description(), }) - commands.commit(ui, repo, **opts) + commands.commit(ui, repo, **pycompat.strkwargs(opts)) newctx = repo['.'] committed.append(newctx)
--- a/mercurial/localrepo.py Sat Feb 24 16:16:14 2018 +0530 +++ b/mercurial/localrepo.py Sat Feb 24 16:18:40 2018 +0530 @@ -2170,10 +2170,11 @@ hookargs = {} if tr is not None: hookargs.update(tr.hookargs) - hookargs['namespace'] = namespace - hookargs['key'] = key - hookargs['old'] = old - hookargs['new'] = new + hookargs = pycompat.strkwargs(hookargs) + hookargs[r'namespace'] = namespace + hookargs[r'key'] = key + hookargs[r'old'] = old + hookargs[r'new'] = new self.hook('prepushkey', throw=True, **hookargs) except error.HookAbort as exc: self.ui.write_err(_("pushkey-abort: %s\n") % exc)
--- a/mercurial/profiling.py Sat Feb 24 16:16:14 2018 +0530 +++ b/mercurial/profiling.py Sat Feb 24 16:18:40 2018 +0530 @@ -143,7 +143,7 @@ elif profformat == 'hotpath': # inconsistent config: profiling.showmin limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05) - kwargs['limit'] = limit + kwargs[r'limit'] = limit statprof.display(fp, data=data, format=displayformat, **kwargs)