# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1519469320 -19800 # Node ID 7b86aa31b00426d7cd911f7c4ce6b850929b5624 # Parent a24c57f1f5c37bd75dee7fd57a51cb0ca6dc372c 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 diff -r a24c57f1f5c3 -r 7b86aa31b004 hgext/largefiles/overrides.py --- 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) diff -r a24c57f1f5c3 -r 7b86aa31b004 hgext/lfs/__init__.py --- 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): diff -r a24c57f1f5c3 -r 7b86aa31b004 hgext/rebase.py --- 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) diff -r a24c57f1f5c3 -r 7b86aa31b004 hgext/split.py --- 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) diff -r a24c57f1f5c3 -r 7b86aa31b004 mercurial/localrepo.py --- 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) diff -r a24c57f1f5c3 -r 7b86aa31b004 mercurial/profiling.py --- 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)