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

Martin von Zweigbergk martinvonz at google.com
Thu Mar 16 08:56:11 EDT 2017


On Mar 16, 2017 00:18, "Pulkit Goyal" <7895pulkit at gmail.com> wrote:



On Thu, Mar 16, 2017 at 10:14 AM, Martin von Zweigbergk <
martinvonz at google.com> wrote:

> 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 <(219)%20487-2454>
> > 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?


​I am not sure about how you are saying to that. Using pycompat.iterbytes()
we can iterate on 'MAR!?C', but in these we are iterating over three things
at once.​



I mean to wrap it in the call to zip, so zip(x, iterbytes(y), z).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170316/aa16e54d/attachment.html>


More information about the Mercurial-devel mailing list