[PATCH 02 of 10] py3: convert kwargs' keys to str using pycompat.strkwargs

Yuya Nishihara yuya at tcha.org
Sat May 6 22:04:22 EDT 2017


On Sat, 06 May 2017 08:31:14 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1493837661 -19800
> #      Thu May 04 00:24:21 2017 +0530
> # Node ID 2ed3b0dfc16ab5eb77fd95d4b09d312d43d76b4b
> # Parent  72a79c82aa8913f1661af3d7dc3b14d856679bd9
> py3: convert kwargs' keys to str using pycompat.strkwargs
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1499,7 +1499,8 @@
>  
>          # write header
>          if self._parts['header']:
> -            h = templater.stringify(self.t(self._parts['header'], **props))
> +            h = templater.stringify(self.t(self._parts['header'],
> +                    **pycompat.strkwargs(props)))
>              if self.buffered:
>                  self.header[ctx.rev()] = h
>              else:
> @@ -1509,13 +1510,14 @@
>  
>          # write changeset metadata, then patch if requested
>          key = self._parts['changeset']
> -        self.ui.write(templater.stringify(self.t(key, **props)))
> +        self.ui.write(templater.stringify(self.t(key,
> +                                    **pycompat.strkwargs(props))))
>          self.showpatch(ctx, matchfn)
>  
>          if self._parts['footer']:
>              if not self.footer:
>                  self.footer = templater.stringify(
> -                    self.t(self._parts['footer'], **props))
> +                    self.t(self._parts['footer'], **pycompat.strkwargs(props)))

This is okay, but can't we reuse the result of pycompat.strkwargs(props)?
I think that's good for code readability.


More information about the Mercurial-devel mailing list