Another try ... and som extras
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.
I’m not sure about the last ones. Which Python and Mercurial versions does hgview support?
I suggest dropping the old stuff and focus on Python 2.7+ and something like Mercurial 5.0+ . And soon Python 3 …
-
Fix "AttributeError: 'QString' object has no attribute 'encode'" crash on startup
Evidently a problem that only is seen in some setups, and not in others.
But for example on Fedora Linux, we see "AttributeError: 'QString' object has no attribute 'encode'" evidently from the hgviewlib/qt4/hgrepoviewer.py "compose" with to_utf8 = methodcaller('encode', 'utf-8')
The root cause of the problem seems to be that Qt for some reason sometimes in some setups in some places will return QStrings in some places instead of plain unicode strings. (On Fedora, I see QString when using Python 2, and plain unicode str when using Python 3, so I assume that problem has been fixed now.)
It seems quite reasonable that a Qt callback must be able to handle Qt strings. So let's just handle the problem when we see it, without wrapping the event handlers with confusing "compose".
The old behaviour of always encoding unicode strings as utf-8 (which be different than the encoding of the Mercurial repo) also seems questionable, but don't change that.
-
On reload, use hgviewlib.util.build_repo - not the non-existent mercurial.util.build_repo
-
Fix annotation crash
Mercurial 2e32c6a31cc7 introduced annotateline in 4.4 .
-
Load Mercurial configuration when starting repos
Mercurial d83ca854fa21 4.1 introduced ui.load which should be used to actually read the repo config.
The configuration might enable important extensions or configure username.
-
Show revision tool tips black - they showed up unreadable as white on bright yellow
I don't know the root cause of this, and there must be way better ways to do it. But this works for me and is the best I could come up with.
-
Resource files should usually not be rebuild with pyuic4 at runtime ... but be verbose when we do
Like 964b75047ba2.
For some reason this isn't directly built from setup.py ...
-
Fail loud and clear if pyuic4 fails
-
Invoke pyrcc4 with -py3 to generate resource files that works for Python >= 2.6 - including 3
https://www.riverbankcomputing.com/static/Docs/PyQt4/resources.html
-
Avoid iterator.repeat warning - just drop python2.5 support
Addresss 2to3 warnings while refactoring:
RefactoringTool: ### In file ./hgviewlib/curses/graphlog.py ### RefactoringTool: Line 36: You should use 'operator.mul(fillvalue)' here.