Source

qct / qct

Full commit
#!/usr/bin/env python

# qct - Commit Tool
#
# Copyright 2006 Steve Borho
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.

import sys
import getopt
from PyQt4 import QtCore, QtGui
from qctDialogLogic import CommitTool

# Standalone command line application

if __name__ == "__main__":
    # parse command line options
    opts = []
    try:
        opts, args = getopt.getopt(sys.argv[1:], "4bgh", ["p4", "bzr", "hg", "git"])
    except getopt.error, msg:
        pass
    # default to mercurial VCS back-end if no matches were found
    if len(opts) == 0:
        from qctVcsHg import qctVcsHg
        vcs = qctVcsHg()
    # process options
    for opt, arg in opts:
        if opt in ("-4", "--p4"):
            from qctVcsP4 import qctVcsP4
            vcs = qctVcsP4()
        if opt in ("-h", "--hg"):
            from qctVcsHg import qctVcsHg
            vcs = qctVcsHg()
        elif opt in ("-g", "--git"):
            from qctVcsGit import qctVcsGit
            vcs = qctVcsGit()
        elif opt in ("-b", "--bzr"):
            from qctVcsBzr import qctVcsBzr
            vcs = qctVcsBzr()

    if vcs.initRepo(sys.argv) != 0:
        sys.exit()

    # Now we know it's worth the trouble to open the GUI
    app = QtGui.QApplication(sys.argv)
    dialog = CommitTool(vcs)
    dialog.show()
    sys.exit(app.exec_())