Beispiel #1
0
def create_tarball(self):
    ref = self._clicked_item.commit.sha1
    dlg = GitArchiveDialog.create(ref, parent=self)
    if dlg is None:
        return
    self.emit(SIGNAL(archive), ref, dlg.fmt, dlg.prefix, dlg.filename)
    qtutils.information('File Saved', 'File saved to "%s"' % dlg.filename)
Beispiel #2
0
def cmd_archive(args):
    context = application_init(args, update=True)
    if args.ref is None:
        args.ref = context.model.currentbranch

    from cola.widgets.archive import GitArchiveDialog
    view = GitArchiveDialog(args.ref)
    return application_start(context, view)
Beispiel #3
0
 def create_tarball(self):
     sha1 = self.selected_sha1()
     if sha1 is None:
         return
     short_sha1 = sha1[:7]
     GitArchiveDialog.save_hashed_objects(sha1, short_sha1, self)
Beispiel #4
0
 def save_archive(self):
     ref = git.rev_parse('HEAD')[STDOUT]
     shortref = ref[:7]
     GitArchiveDialog.save_hashed_objects(ref, shortref, self)
Beispiel #5
0
def main(context):
    """Parses the command-line arguments and starts git-cola
    """
    setup_environment()
    opts, args, context = parse_args(context)
    repo = process_args(opts, args)

    # Allow Ctrl-C to exit
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # Initialize the app
    app = ColaApplication(sys.argv)

    # Ensure that we're working in a valid git repository.
    # If not, try to find one.  When found, chdir there.
    model = cola.model()
    valid = model.set_worktree(repo) and not opts.prompt
    while not valid:
        startup_dlg = startup.StartupDialog(app.activeWindow())
        gitdir = startup_dlg.find_git_repo()
        if not gitdir:
            sys.exit(-1)
        valid = model.set_worktree(gitdir)

    # Finally, go to the root of the git repo
    os.chdir(model.git.worktree())

    # Show the GUI
    if context == 'archive':
        from cola.widgets.archive import GitArchiveDialog
        model.update_status()
        view = GitArchiveDialog(model.currentbranch)
    elif context == 'branch':
        from cola.widgets.createbranch import create_new_branch
        view = create_new_branch()
    elif context in ('git-dag', 'dag'):
        from cola.dag import git_dag
        view = git_dag(model, opts=opts, args=args)
    elif context in ('classic', 'browse'):
        from cola.classic import cola_classic
        view = cola_classic(update=False)
    elif context == 'config':
        from cola.prefs import preferences
        view = preferences()
    elif context == 'diff':
        from cola.difftool import diff_expression
        while args and args[0] == '--':
            args.pop(0)
        expr = subprocess.list2cmdline(map(core.decode, args))
        view = diff_expression(None, expr, create_widget=True)
    elif context == 'fetch':
        # TODO: the calls to update_status() can be done asynchronously
        # by hooking into the message_updated notification.
        from cola.widgets import remote
        model.update_status()
        view = remote.fetch()
    elif context == 'grep':
        from cola.widgets import grep
        view = grep.run_grep(parent=None)
    elif context == 'merge':
        from cola.merge import view
        model.update_status()
        view = view.MergeView(model, parent=None)
    elif context == 'pull':
        from cola.widgets import remote
        model.update_status()
        view = remote.pull()
    elif context == 'push':
        from cola.widgets import remote
        model.update_status()
        view = remote.push()
    elif context == 'remote':
        from cola.widgets import editremotes
        view = editremotes.edit()
    elif context == 'search':
        from cola.widgets.search import search
        view = search()
    elif context == 'stash':
        from cola.stash import stash
        model.update_status()
        view = stash()
    elif context == 'tag':
        from cola.widgets.createtag import create_tag
        view = create_tag()
    else:
        view = MainView(model, qtutils.active_window())

    # Make sure that we start out on top
    view.show()
    view.raise_()

    # Scan for the first time
    task = _start_update_thread(model)

    # Start the inotify thread
    inotify.start()

    msg_timer = QtCore.QTimer()
    msg_timer.setSingleShot(True)
    msg_timer.connect(msg_timer, SIGNAL('timeout()'), _send_msg)
    msg_timer.start(0)

    # Start the event loop
    result = app.exec_()

    # All done, cleanup
    inotify.stop()
    QtCore.QThreadPool.globalInstance().waitForDone()

    pattern = utils.tmp_file_pattern()
    for filename in glob.glob(pattern):
        os.unlink(filename)
    sys.exit(result)

    return view, task
Beispiel #6
0
 def save_archive(self):
     ref = git.rev_parse('HEAD')[STDOUT]
     shortref = ref[:7]
     GitArchiveDialog.save_hashed_objects(ref, shortref, self)
Beispiel #7
0
 def create_tarball(self):
     sha1 = self.selected_sha1()
     if sha1 is None:
         return
     short_sha1 = sha1[:7]
     GitArchiveDialog.save_hashed_objects(sha1, short_sha1, self)
Beispiel #8
0
 def save_archive(self):
     ref = git.rev_parse('HEAD')
     shortref = ref[:7]
     GitArchiveDialog.save(ref, shortref, self)
Beispiel #9
0
 def save_archive(self):
     ref = git.rev_parse('HEAD')
     shortref = ref[:7]
     GitArchiveDialog.save(ref, shortref, self)
Beispiel #10
0
def main(context):
    """Parses the command-line arguments and starts git-cola
    """
    setup_environment()
    opts, args, context = parse_args(context)
    repo = process_args(opts, args)

    # Allow Ctrl-C to exit
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # Initialize the app
    app = ColaApplication(sys.argv)

    # Ensure that we're working in a valid git repository.
    # If not, try to find one.  When found, chdir there.
    model = cola.model()
    valid = model.set_worktree(repo) and not opts.prompt
    while not valid:
        startup_dlg = startup.StartupDialog(app.activeWindow())
        gitdir = startup_dlg.find_git_repo()
        if not gitdir:
            sys.exit(-1)
        valid = model.set_worktree(gitdir)

    # Finally, go to the root of the git repo
    os.chdir(model.git.worktree())

    # Show the GUI
    if context == "archive":
        from cola.widgets.archive import GitArchiveDialog

        model.update_status()
        view = GitArchiveDialog(model.currentbranch)
    elif context == "branch":
        from cola.widgets.createbranch import create_new_branch

        view = create_new_branch()
    elif context in ("git-dag", "dag"):
        from cola.dag import git_dag

        ctl = git_dag(model, opts=opts, args=args)
        view = ctl.view
    elif context in ("classic", "browse"):
        from cola.classic import cola_classic

        view = cola_classic(update=False)
    elif context == "config":
        from cola.prefs import preferences

        ctl = preferences()
        view = ctl.view
    elif context == "fetch":
        # TODO: the calls to update_status() can be done asynchronously
        # by hooking into the message_updated notification.
        from cola.widgets import remote

        model.update_status()
        view = remote.fetch()
    elif context == "grep":
        from cola.widgets import grep

        view = grep.run_grep(parent=None)
    elif context == "pull":
        from cola.widgets import remote

        model.update_status()
        view = remote.pull()
    elif context == "push":
        from cola.widgets import remote

        model.update_status()
        view = remote.push()
    elif context == "remote":
        from cola.widgets import editremotes

        view = editremotes.edit()
    elif context == "search":
        from cola.widgets.search import search

        view = search()
    elif context == "stash":
        from cola.stash import stash

        model.update_status()
        view = stash().view
    elif context == "tag":
        from cola.widgets.createtag import create_tag

        view = create_tag()
    else:
        view = MainView(model, qtutils.active_window())
        ctl = MainController(model, view)

    # Install UI wrappers for command objects
    cfgactions.install_command_wrapper()
    guicmds.install_command_wrapper()

    # Make sure that we start out on top
    view.show()
    view.raise_()

    # Scan for the first time
    task = _start_update_thread(model)

    # Start the inotify thread
    inotify.start()

    msg_timer = QtCore.QTimer()
    msg_timer.setSingleShot(True)
    msg_timer.connect(msg_timer, SIGNAL("timeout()"), _send_msg)
    msg_timer.start(0)

    # Start the event loop
    result = app.exec_()

    # All done, cleanup
    inotify.stop()
    QtCore.QThreadPool.globalInstance().waitForDone()

    pattern = utils.tmp_file_pattern()
    for filename in glob.glob(pattern):
        os.unlink(filename)
    sys.exit(result)

    return ctl, task
Beispiel #11
0
 def save_archive(self):
     ref = git.rev_parse("HEAD")[STDOUT]
     shortref = ref[:7]
     GitArchiveDialog.save(ref, shortref, self)