Python 3 support
Created originally on Bitbucket by kiilerix (Mads Kiilerich)
Changesets for this Pull Request have not been imported, because it had been already declined on Bitbucket. Marked as closed by the import user.
This will make hgview support both Python 2.7 and Python 3.
The changes while running Python 2 is minimal and the risk should be low. But please review and test carefully for cases you might care about. Especially around corner cases of encoding.
The Python 3 port will need more testing. Bugs will be found, and type conversions must be added. Careful review and testing is even more important here, but details can perhaps be fixed later, after landing most of this.
The changes are all clean and separate and should be reviewed separately, one changeset at a time. Most of them are fine to apply partially or left out - tricky parts can be revisited later.
The changes are polished and ordered in a way where changes either fit in naturally, or when they fix a problem that would cause problems if trying to run with Python 3.