[PATCH 6 of 6 py3] commands: make sure using byteschr rather than ascii values

Martin von Zweigbergk martinvonz at google.com
Thu Mar 16 00:44:55 EDT 2017


On Wed, Mar 15, 2017 at 9:13 PM, Pulkit Goyal <7895pulkit at gmail.com> wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1489635793 -19800
> #      Thu Mar 16 09:13:13 2017 +0530
> # Node ID 63aeb39b5802644ae99eaa5cf0666f3bf5cc4e90
> # Parent  b5673a08993652a92c0e20a4e24d842194872454
> commands: make sure using byteschr rather than ascii values
>
> 'MAR!?IC' is converted to their ascii values when slicing through it. This
> patch converts them back to bytes string.
>
> diff -r b5673a089936 -r 63aeb39b5802 mercurial/commands.py
> --- a/mercurial/commands.py     Thu Mar 16 09:00:27 2017 +0530
> +++ b/mercurial/commands.py     Thu Mar 16 09:13:13 2017 +0530
> @@ -4768,6 +4768,8 @@
>      showchar = not opts.get('no_status')
>
>      for state, char, files in changestates:
> +        if pycompat.ispy3:
> +            char = bytes([char])

I'd prefer to wrap 'MAR!?C' in pycompat.iterbytestr() to avoid the
conditional here. What do you think?. Would that work?

>          if state in show:
>              label = 'status.' + state
>              for f in files:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list