PoC showing hg running on Python 3.5 without 2to3

Gregory Szorc gregory.szorc at gmail.com
Mon Jun 22 15:16:03 UTC 2015


I successfully made `hg --version` work on Python 3.5b2 without relying on
the 2to3 rewriting tool!

$ hg pull -r  598011934aa4
https://hg.mozilla.org/users/gszorc_mozilla.com/hg
$ hg up 598011934aa4
$ HGRCPATH=/dev/null HGDEMANDIMPORT=disable
~/.pyenv/versions/3.5.0b2/bin/python hg --version
b'Mercurial Distributed SCM (version unknown)\n'b'(see
http://mercurial.selenic.com for more information)\n\nCopyright (C)
2005-2015 Matt Mackall and others\nThis is free software; see the source
for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.\n'

The output formatting obviously isn't correct. But it demonstrates that
modules can be imported and basic dispatch works. You need to start
somewhere.

In my zeal to produce this 176 commit series, I took a number of shortcuts.
My goal was to get Python 3 working at no costs. This meant creating some
hacky patches that drop 2.x compatibility. This compatibility can be
restored with a few more hours of work.

The "use modern exception syntax" and "use modern octal literals syntax"
subset of commits can likely land today. The absolute imports commits could
also start landing. Although, I believe we need a bikeshed over how we want
to formulate imports going forward (grouping, alphabetize, etc). The rest
of the commits are generally hacky (I tried to put "HACK" in the commit
summary line to indicate the commit isn't suitable for consideration).

The series really isn't in a terrific state to facilitate cherry picking.
But it could be. Please let me know what you are interested in taking and
I'll rewrite things accordingly. (I think mass rewriting to modern
exception and octal literal syntax and enforcing these via check-style
would be good first steps.)

Gregory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150622/273fe680/attachment.html>


More information about the Mercurial-devel mailing list