[PATCH 0 of 3 RFC] Custom 2to3 fixers for hg

Matt Mackall mpm at selenic.com
Tue Aug 3 13:46:52 CDT 2010


On Tue, 2010-08-03 at 14:06 -0300, Renato Cunha wrote:
> Hello,
> 
> this patch series contain the most of my work for the second half of GSoC. They
> are:

Queued.

>  - A 2to3-enabled setup.py that allows users to build hg with an automatic
>    call to python's refactoring tool;

That's actually not in here..

>  - A fixer that converts plain strings to bytes (details in its commit
>    message);
>  - A "compatibility" module that adds some utility functions to 2to3 and
>    monkeypatches os.environ;
>  - A fixer that converts b'foo %s' % b'bar', as it won't work in py3k.
> 
> Drawbacks of the current approach:
> 
> Converting *all* bytestrings is not as good as it seems, since py3k will break
> everytime a bytes object is passed where it expected (unicode) strings. Some
> calls that fail and I haven't fixed yet:
> 
>  * ord will break when fed with something like ord(b'a'[0])
>  * os.getcwd will return unicode. Must translate calls to os.getcwdb
>  * __slots__ in mdiff must be strings, not bytes

I don't think we have any users of __slots__ that actually matter.

>  * there are some inconsistencies that I still don't know how to handle, like
>    2to3 will convert "import hgweb.server" to "from . import hgweb.server",
>    which breaks in runtime. How to handle that?
>  * some other stuff I must have forgotten.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list