Mercurial > hg
changeset 33017:c31d45623304
py3: convert kwargs' keys' to str using pycompat.strkwargs()
On Python 3, we must have keys of keyword arguments as str.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 22 Jun 2017 03:16:16 +0530 |
parents | 4e6dc34b5d7a |
children | 071732d9c210 |
files | mercurial/exchange.py mercurial/simplemerge.py mercurial/templatekw.py mercurial/templater.py |
diffstat | 4 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Thu Jun 22 03:10:24 2017 +0530 +++ b/mercurial/exchange.py Thu Jun 22 03:16:16 2017 +0530 @@ -1610,7 +1610,7 @@ for name in getbundle2partsorder: func = getbundle2partsmapping[name] func(bundler, repo, source, bundlecaps=bundlecaps, b2caps=b2caps, - **kwargs) + **pycompat.strkwargs(kwargs)) return bundler.getchunks()
--- a/mercurial/simplemerge.py Thu Jun 22 03:10:24 2017 +0530 +++ b/mercurial/simplemerge.py Thu Jun 22 03:16:16 2017 +0530 @@ -24,6 +24,7 @@ from . import ( error, mdiff, + pycompat, util, vfs as vfsmod, ) @@ -455,7 +456,8 @@ extrakwargs['base_marker'] = '|||||||' extrakwargs['name_base'] = name_base extrakwargs['minimize'] = False - for line in m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs): + for line in m3.merge_lines(name_a=name_a, name_b=name_b, + **pycompat.strkwargs(extrakwargs)): out.write(line) if not opts.get('print'):
--- a/mercurial/templatekw.py Thu Jun 22 03:10:24 2017 +0530 +++ b/mercurial/templatekw.py Thu Jun 22 03:16:16 2017 +0530 @@ -119,23 +119,24 @@ expand 'end_foos'. ''' templ = mapping['templ'] + strmapping = pycompat.strkwargs(mapping) if not plural: plural = name + 's' if not values: noname = 'no_' + plural if noname in templ: - yield templ(noname, **mapping) + yield templ(noname, **strmapping) return if name not in templ: if isinstance(values[0], bytes): yield separator.join(values) else: for v in values: - yield dict(v, **mapping) + yield dict(v, **strmapping) return startname = 'start_' + plural if startname in templ: - yield templ(startname, **mapping) + yield templ(startname, **strmapping) vmapping = mapping.copy() def one(v, tag=name): try: @@ -146,7 +147,7 @@ vmapping[a] = b except ValueError: vmapping[name] = v - return templ(tag, **vmapping) + return templ(tag, **pycompat.strkwargs(vmapping)) lastname = 'last_' + name if lastname in templ: last = values.pop() @@ -158,7 +159,7 @@ yield one(last, tag=lastname) endname = 'end_' + plural if endname in templ: - yield templ(endname, **mapping) + yield templ(endname, **strmapping) def _formatrevnode(ctx): """Format changeset as '{rev}:{node|formatnode}', which is the default