[PATCH 01 of 10] py3: use unicode literals in encoding.py

Gregory Szorc gregory.szorc at gmail.com
Thu Aug 4 12:23:19 EDT 2016



> On Aug 4, 2016, at 06:11, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
> 
> 
> 
>> On 08/04/2016 02:59 PM, Jun Wu wrote:
>> Excerpts from Yuya Nishihara's message of 2016-08-04 21:42:22 +0900:
>>> I don't think it's good idea to switch b''/u'' requirement per file.
>> 
>> +1. This may lead us to split code into different files while it's actually
>> unnecessary.
> 
> yep, keeping different behavior from one file to another will create fun situation when moving code around. I think we should avoid that.
> 
>> I'd like a smarter transformer handling cases like os.environ automatically.
> 
> from previous discussion (and environ/environb plateform madness) I was under the impression we needed an utility wrapper to access environ anyway. Could the complexity lives here instead?

Don't we already hang the environ off ui somewhere? That seems like the ideal place to make these changes.

A number of the bytes/str issues we're seeing now occur at *import time*. It's a best practice for module imports to be side-effect free. It is scope bloat, but refactoring this code so it is called after import - by some kind of global hginit() would be a step in the right direction IMO. We could then pass some kind of context object around instead of relying on global state. Remember: global variables are usually considered evil and os.environ, sys.args, pwd, etc are al global variables.

> 
>> If we are going to have switches in file comments, I think it's better to
>> make it possible at chunk-level instead of just file-level.
> 
> At that point I feel like we are probably better off using prefix.
> 
> -- 
> Pierre-Yves David


More information about the Mercurial-devel mailing list