Hi, On Sat, Jul 27, 2019 at 1:12 AM Mads Kiilerich <m...@kiilerich.com> wrote:
> On 7/26/19 4:08 PM, Simon Giesecke wrote: > > Hi, > > > > I needed the following patches to get hgview (with the Qt frontend) > > basically running on my Fedora 30 instance. Please consider merging them. > > > I confirm they make the QT frontend work - tested with Mercurial 4.9. > > (The curses frontend is however still broken. And migration to Python 3 > will very soon be necessary for Fedora packaging.) > Yes that's true, I can check migrating to Python 3, but probably some dependencies will need to be migrated first. > # HG changeset patch > > # User Simon Giesecke <sgiese...@mozilla.com> > > # Date 1562663911 -7200 > > # Tue Jul 09 11:18:31 2019 +0200 > > # Node ID 273b4ae25ccb8e26ca8b27b61861a621abcfb71f > > # Parent 7f3142453cd546d701a7455cab9568cce08d9974 > > Bugfix: do not return matcher function, but use it for calling diff > > > Fixing a trivial recent regression for Mercurial < 5.0 from > http://hg.logilab.org/review/hgview/rev/15113c412f4c . > > > > > > # HG changeset patch > > # User Simon Giesecke <sgiese...@mozilla.com> > > # Date 1562664056 -7200 > > # Tue Jul 09 11:20:56 2019 +0200 > > # Node ID e73ef9c7f73339207df78209f8b9ed384c166aad > > # Parent 273b4ae25ccb8e26ca8b27b61861a621abcfb71f > > Bugfix: status may be a QVariant > > > Is it known what introduced this change? Is the old behaviour still > relevant? > Unfortunately, I have no idea. I am not familiar with PyQt4 or sip, I was just trying to do some minimal changes to make it work. Probably this is not the best approach, following https://www.riverbankcomputing.com/static/Docs/PyQt4/python_v3.html#qvariant (this is about Python3, but I did not find any equivalent documentation regarding Python2) and https://www.riverbankcomputing.com/static/Docs/PyQt4/pyqt_qvariant.html, which sounds as if converting to int should actually work. So maybe this is more a bug in PyQt4, and my change just works around that? Unfortunately, I have no idea when hgview last worked, since I am a new user. > diff --git a/hgviewlib/qt4/hgrepoviewer.py b/hgviewlib/qt4/hgrepoviewer.py > > --- a/hgviewlib/qt4/hgrepoviewer.py > > +++ b/hgviewlib/qt4/hgrepoviewer.py > > @@ -299,6 +299,9 @@ class HgRepoViewer(ActionsMixin, HgDialo > > else: > > try: > > status = int(status) > > + except TypeError: > > + # assume status is a QVariant > > + status = int(status.toBool()) > > except ValueError: > > # for backward compatibility > > status = {'false': False , 'true': > > True}.get(status.lower(), status) > > > Instead of catching the generic TypeError, how about something like: > > status = settings.value(entryname) > if status is None: > status = 1 > + elif isinstance(status, QtCore.QVariant): > + status = int(status.toBool()) > else: > try: > status = int(status) > > Yes, that's probably better, I will change the patch to do just that. Thanks for the suggestion! Best wishes Simon
_______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org https://lists.logilab.org/mailman/listinfo/python-projects