def setUp(self, commit=True): TmpPathTestCase.setUp(self) self.initialize_repo() if commit: self.commit_files() gitcmd.instance().load_worktree(os.getcwd()) gitcfg.instance().reset()
def __init__(self): self.git = gitcmd.instance() self._system = {} self._user = {} self._repo = {} self._cache_key = None self._configs = [] self._config_files = {} self._find_config_files()
def __init__(self): observable.ObservableModel.__init__(self) self.git = gitcmd.instance() self.descriptions_start = [] self.descriptions_end = [] self.revisions_start = [] self.revisions_end = [] self.revision_start = '' self.revision_end = '' self.compare_files = [] self.num_results = 100 self.show_versions=False
def __init__(self, cwd=None): """Reads git repository settings and sets several methods so that they refer to the git module. This object encapsulates cola's interaction with git.""" ObservableModel.__init__(self) # Initialize the git command object self.git = gitcmd.instance() ##################################################### self.head = 'HEAD' self.mode = self.mode_none self.diff_text = '' self.filename = None self.currentbranch = '' self.trackedbranch = '' self.directory = '' self.git_version = self.git.version() self.remotes = [] self.remotename = '' self.local_branch = '' self.remote_branch = '' ##################################################### # Status info self.commitmsg = '' self.modified = [] self.staged = [] self.unstaged = [] self.untracked = [] self.unmerged = [] self.upstream_changed = [] ##################################################### # Refs self.revision = '' self.local_branches = [] self.remote_branches = [] self.tags = [] self.revisions = [] self.summaries = [] self.fetch_helper = None self.push_helper = None self.pull_helper = None self.generate_remote_helpers() if cwd: self.use_worktree(cwd)
def __init__(self): observable.ObservableModel.__init__(self) self.git = gitcmd.instance() self.remote_branches = gitcmds.branch_list(remote=True) self.local_branches = gitcmds.branch_list(remote=False) self.left_combo = ['Local', 'Remote'] self.right_combo = ['Local', 'Remote'] self.left_combo_index = 0 self.right_combo_index = 1 self.left_list = [] self.right_list = [] self.left_list_index = -1 self.right_list_index = -1 self.left_list_selected = False self.right_list_selected = False self.diff_files = []
"""Provides commands and queries for Git.""" import os import re from cStringIO import StringIO from cola import core from cola import gitcmd from cola import gitcfg from cola import errors from cola import utils from cola import version git = gitcmd.instance() config = gitcfg.instance() def default_remote(): """Return the remote tracked by the current branch.""" return config.get('branch.%s.remote' % current_branch()) def diff_filenames(arg): """Return a list of filenames that have been modified""" diff_zstr = git.diff(arg, name_only=True, z=True).rstrip('\0') return [core.decode(f) for f in diff_zstr.split('\0') if f] def all_files(): """Return the names of all files in the repository""" return [core.decode(f) for f in git.ls_files(z=True)
def git_version(): """Returns the current GIT version""" global _git_version if _git_version is None: _git_version = gitcmd.instance().version().split()[-1] return _git_version