Submitter | timeless |
---|---|
Date | April 20, 2016, 7:19 p.m. |
Message ID | <80fe1d921a06bd78395f.1461179962@gcc2-power8.osuosl.org> |
Download | mbox | patch |
Permalink | /patch/14745/ |
State | Rejected |
Delegated to: | Pierre-Yves David |
Headers | show |
Comments
On Wed, 20 Apr 2016 19:19:22 +0000, timeless wrote: > # HG changeset patch > # User timeless@gmail.com > # Date 1461178867 0 > # Wed Apr 20 19:01:07 2016 +0000 > # Node ID 80fe1d921a06bd78395fb8b4ee572fafd71587a4 > # Parent 5f3fbe0fb1f34de87e62e76de7e48e49993b60d5 > # Available At https://bitbucket.org/timeless/mutable-history/ > # hg pull https://bitbucket.org/timeless/mutable-history/ -r 80fe1d921a06 > py3: handle bytes/strings > > diff -r 5f3fbe0fb1f3 -r 80fe1d921a06 hgext/evolve.py > --- a/hgext/evolve.py Wed Apr 20 19:00:13 2016 +0000 > +++ b/hgext/evolve.py Wed Apr 20 19:01:07 2016 +0000 > @@ -1101,7 +1101,7 @@ > else: > fn, opts, = entry > deprecationwarning = _('%s have been deprecated in favor of %s\n') % ( > - oldalias, newalias) > + oldalias.encode('utf-8'), newalias.encode('utf-8')) The caller should convert 'oldalias' and 'newalias' to bytes because almost all Mercurial functions expect bytes (py2-str) instead of py3-str (unicode).
On 04/22/2016 05:14 PM, Yuya Nishihara wrote: > On Wed, 20 Apr 2016 19:19:22 +0000, timeless wrote: >> # HG changeset patch >> # User timeless@gmail.com >> # Date 1461178867 0 >> # Wed Apr 20 19:01:07 2016 +0000 >> # Node ID 80fe1d921a06bd78395fb8b4ee572fafd71587a4 >> # Parent 5f3fbe0fb1f34de87e62e76de7e48e49993b60d5 >> # Available At https://bitbucket.org/timeless/mutable-history/ >> # hg pull https://bitbucket.org/timeless/mutable-history/ -r 80fe1d921a06 >> py3: handle bytes/strings >> >> diff -r 5f3fbe0fb1f3 -r 80fe1d921a06 hgext/evolve.py >> --- a/hgext/evolve.py Wed Apr 20 19:00:13 2016 +0000 >> +++ b/hgext/evolve.py Wed Apr 20 19:01:07 2016 +0000 >> @@ -1101,7 +1101,7 @@ >> else: >> fn, opts, = entry >> deprecationwarning = _('%s have been deprecated in favor of %s\n') % ( >> - oldalias, newalias) >> + oldalias.encode('utf-8'), newalias.encode('utf-8')) > The caller should convert 'oldalias' and 'newalias' to bytes because almost > all Mercurial functions expect bytes (py2-str) instead of py3-str (unicode). +1 I would rather see the proper type passed in the first place instead of having some silent magic at work internally. In my opinion, we don't plan to use unicode function name any time soon. I've taken the rest of the series because "It's done" and "why not" but I don't see to much point in spending too time making evolve py3 compatible for now. On the py3 effort we should focus on having core Mercurial working first before trying to have extension compatible too. Moreover, evolve content is meant to migrate into core so we can maybe take care of the compatibility when that happen ? Cheers
Patch
diff -r 5f3fbe0fb1f3 -r 80fe1d921a06 hgext/evolve.py --- a/hgext/evolve.py Wed Apr 20 19:00:13 2016 +0000 +++ b/hgext/evolve.py Wed Apr 20 19:01:07 2016 +0000 @@ -1101,7 +1101,7 @@ else: fn, opts, = entry deprecationwarning = _('%s have been deprecated in favor of %s\n') % ( - oldalias, newalias) + oldalias.encode('utf-8'), newalias.encode('utf-8')) def newfn(*args, **kwargs): ui = args[0] ui.warn(deprecationwarning)