[PATCH 0 of 3 RFC] Custom 2to3 fixers for hg
Renato Cunha
renatoc at gmail.com
Tue Aug 3 17:06:37 UTC 2010
Hello,
this patch series contain the most of my work for the second half of GSoC. They
are:
- A 2to3-enabled setup.py that allows users to build hg with an automatic
call to python's refactoring tool;
- 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
* 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.
Regards,
Renato Cunha.
More information about the Mercurial-devel
mailing list