Skip to content

Various fixes

Bitbucket Importer requested to merge bitbucket/declined-pr-6 into branch/default

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.

  • 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 QtStrings in some callbacks 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 also seems questionable, but don't change that.

  • Handle actions showing up as QtString

    In some setups ...

  • Don't pass QString to Mercurial internals - retrieve the proper string value

    Fix AttributeError: 'QString' object has no attribute 'startswith'

    Apparently not a problem seen in all setups, so leave the code so it also can handle the previous state.

  • Mercurial no longer support revision numbers as strings - they must be integers

    Passing it as integer has always been supported.

    Fix crash when clicking parent revision hash: mercurial.error.ProgrammingError: unsupported changeid '1152' of type <type 'str'>

  • Drop old hack and use linkrev when finding revision from filelog

    Fix AttributeError: 'filelog' object has no attribute 'index' on double clicking filename.

  • Fix curses UI crash when hitting TAB and other undefined keys

    There is no NoneType.startswith .

  • Cleanup: more clean handling of status that may be a QVariant

    Redo e73ef9c7f733 in a more elegant way.

  • Report relevant values in assert failures

    This would have helped me debug some failures ...

  • Drop odd unused import of "nonexistent" os.path.glob

  • Proper implementation of updateRowCount

    Python2 allows comparing integers with None, and it thus worked. But the proper thing is evidently to set it to 0.

  • Don't use None as modified date if repo is locked - that doesn't have a natural ordering with previous check time

  • Replace file() with future proof open()

  • Improve pyrcc4 error reporting

    pyrcc4 might be run at runtime if resources seem out of date. That is a bit of hack, hopefully only used during development.

    pyrcc4 might not be available if development isn't installed. Make it explicit that something is outdated and we "have" to run it.

    Also when running it properly from setup.py, the error message could disappear in the long log. Make sure to report failures loud and clear, and make a brutal exit.

    setup.py will now fail like:

    Resource files are outdated, ran: ['pyrcc4', 'hgviewlib/qt4/hgqv.qrc', '-o', 'build/lib/hgviewlib/qt4/hgqv_rc.py'] pyrcc4 failed: [Errno 2] No such file or directory

    Failure at runtime will look like:

    Resource files are outdated, running: pyrcc4 /home/mk/hgview/hgviewlib/qt4/hgqv.qrc -o /home/mk/hgview/hgviewlib/qt4/hgqv_rc.py sh: pyrcc4: command not found ERROR: Cannot convert the resource file '/home/mk/hgview/hgviewlib/qt4/hgqv.qrc' into a python module. Please check the PyQt 'pyrcc4' tool is installed, or do it by hand running

Merge request reports