cola.models.main – Main application model

Provides access to git data.

This module provides the central cola model.

class cola.models.main.MainModel(cwd=None)

Provides a friendly wrapper for doing common git operations.

all_branches()
apply_diff(filename)
apply_diff_font_size(default)
apply_diff_to_worktree(filename)
broadcast_updated()
cherry_pick_list(revs, **kwargs)

Cherry-picks each revision into the current branch. Returns a list of command output strings (1 per cherry pick)

cola_config(key)
commit_with_msg(msg, amend=False)

Creates a git commit.

config_dict(local=True)

parses the lines from git config –list into a dictionary

config_params()
config_set(key, value, local=True)
create_branch(name, base, track=False)

Create a branch named ‘name’ from revision ‘base’

Pass track=True to create a local tracking branch.

delete_branch(branch)
editor()
enable_staging()

Whether staging should be allowed.

everything()

Returns a sorted list of all files, including untracked files.

gen_remote_helper(gitaction, push=False)

Generates a closure that calls git fetch, push or pull

generate_remote_helpers()

Generates helper methods for fetch, push and pull

getcwd()

If we’ve chosen a directory then use it, otherwise os.getcwd().

global_config(key, default=None)
gui_config(key)
history_browser()
is_commit_published()
local_config(key, default=None)
message_about_to_update = 'about_to_update'
message_updated = 'updated'
mode_amend = 'amend'
mode_branch = 'branch'
mode_diff = 'diff'
mode_diff_expr = 'diff_expr'
mode_grep = 'grep'
mode_index = 'index'
mode_none = 'none'
mode_review = 'review'
mode_worktree = 'worktree'
modes_read_only = ('branch', 'grep', 'diff', 'diff_expr', 'review')
modes_undoable = ('none', 'index', 'worktree')
pad(pstr, num=22)
parse_stash_list(revids=False, names=False)

Parses “git stash list” and returns a list of stashes.

prev_commitmsg()

Queries git for the latest commit message.

read_font_sizes()

Read font sizes from the configuration.

read_only()
remember_gui_settings()
remote_args(remote, local_branch='', remote_branch='', ffwd=True, tags=False, rebase=False, push=False)
remote_url(name, action)
reset(*items)
revision_sha1(idx)
save_config_param(param)
set_diff_font(fontstr)

Set the diff font string.

set_remote(remote)
stage_all()
stage_modified()
stage_paths(paths)

Stages add/removals to git.

stage_untracked()
tmp_dir()
tmp_file_pattern()
tmp_filename(prefix='')
undoable()

Whether we can checkout files from the $head.

unstage_all()
unstage_paths(paths)
unstaged

An aggregate of the modified, unmerged, and untracked file lists.

update_file_status(update_index=False)
update_status(update_index=False)
update_status_of_files(files)
use_worktree(worktree)
class cola.models.main.MainSerializer(obj)
post_decode_hook()

Previous topic

cola.models.browser – RepoBrowser model

Next topic

cola.models.gitrepo – Git repo model

This Page