Staging
v0.5.1
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision 43b011f2b5b1ca18ece84e6bc168468f21c52b65 authored by Mads Kiilerich on 04 April 2020, 01:37:48 UTC, committed by Mads Kiilerich on 04 April 2020, 01:37:48 UTC
This widget used multiple inheritance of classes with different __init__ arguments. That doesn't really work reliably when combined with super() that hides the complexity of calling order. Especially not when sip play tricks to emulate the Qt class hierarchy in Python. It would fail with a confusing error about a missing repo argument to QAbstractTableModel.__init__(self, parent) HgRepoListWalker has a public setRepo method which was called at the end of __init__, forwarding all the __init__ parameters. Change that to a __init__ without parameters, and an expectation of invoking setRepo right after __init__. This has the slight disadvantage of potentially exposing partially initialized objects ... but that is a small and necessary price to pay.
1 parent a13d9df
Tip revision: 43b011f2b5b1ca18ece84e6bc168468f21c52b65 authored by Mads Kiilerich on 04 April 2020, 01:37:48 UTC
qt5: simplify initialization of HgRepoListWalker and thus HgRepoListModel
qt5: simplify initialization of HgRepoListWalker and thus HgRepoListModel
Tip revision: 43b011f
hgview
#!/usr/bin/env python3
# hgview: visual mercurial graphlog browser in PyQt4
#
# Copyright 2008-2010 Logilab
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
"""
Hg repository log browser.
This may be used as a standalone application or as a hg extension. See
README file included.
"""
import sys
from os import readlink, lstat
from os.path import join, dirname, abspath, pardir, exists
from imp import load_package
import stat
execpath = abspath(__file__)
# resolve symbolic links
statinfo = lstat(execpath)
if stat.S_ISLNK(statinfo.st_mode):
execpath = join(dirname(execpath), readlink(execpath))
execpath = abspath(execpath)
# if standalone, import manually
setuppath = join(dirname(dirname(execpath)), 'setup.py')
if exists(setuppath): # standalone if setup.py found in src dir
hgviewlibpath = join(dirname(dirname(execpath)), 'hgviewlib')
hgviewlibpath = abspath(hgviewlibpath)
load_package('hgviewlib', hgviewlibpath)
from hgviewlib.application import main
main()
Computing file changes ...