D2420: py3: fix handling of keyword arguments at more places
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat Feb 24 11:19:43 UTC 2018
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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()
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2420
AFFECTED FILES
hgext/largefiles/overrides.py
hgext/lfs/__init__.py
hgext/rebase.py
hgext/split.py
mercurial/localrepo.py
mercurial/profiling.py
CHANGE DETAILS
diff --git a/mercurial/profiling.py b/mercurial/profiling.py
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -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)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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 --git a/hgext/split.py b/hgext/split.py
--- a/hgext/split.py
+++ b/hgext/split.py
@@ -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 --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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.byteskwargs(opts))
# restore original working directory
# (we do this before stripping)
diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -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 --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -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)
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list