Staging
v0.5.0
https://foss.heptapod.net/mercurial/hgview
Raw File
Tip revision: 6b70062505a2d3001f5208161f8a68694534505c authored by David Douard on 30 May 2012, 10:09:40 UTC
close 0.x
Tip revision: 6b70062
hgview_ext.py
from mercurial import hg, commands, ui
import os, sys
import os.path as pos


def start_hgview(ui, repo, **opts):
    ## try to run hgview
    try:
        import hgview
        from hgview.gtk import hgview_gtk
        hgview_gtk.main()
    except ImportError:
        import stat
        exec_path = pos.abspath(__file__)
        # Resolve symbolic links
        statinfo = os.lstat(exec_path)
        if stat.S_ISLNK(statinfo.st_mode):
            exec_path = pos.abspath(pos.join(pos.dirname(exec_path),
                                             os.readlink(exec_path)))
        py_path = pos.abspath(pos.join(pos.dirname(exec_path), ".."))
        sys.path.append(py_path)
    
    
cmdtable = {
    "hgview": (start_hgview,
                       [],
                       "hg hgview [opts]"),
}

back to top