コード例 #1
0
ファイル: helper.py プロジェクト: queer1/git-cola
 def setUp(self, commit=True):
     TmpPathTestCase.setUp(self)
     self.initialize_repo()
     if commit:
         self.commit_files()
     git.instance().set_worktree(os.getcwd())
     gitcfg.instance().reset()
     gitcmds.clear_cache()
コード例 #2
0
ファイル: model.py プロジェクト: yjpark/git-cola
    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."""
        Observable.__init__(self)

        # Initialize the git command object
        self.git = git.instance()

        self.head = 'HEAD'
        self.diff_text = ''
        self.mode = self.mode_none
        self.filename = None
        self.currentbranch = ''
        self.directory = ''
        self.project = ''
        self.remotes = []

        self.commitmsg = ''
        self.modified = []
        self.staged = []
        self.untracked = []
        self.unmerged = []
        self.upstream_changed = []
        self.submodules = set()

        self.local_branches = []
        self.remote_branches = []
        self.tags = []
        if cwd:
            self.set_worktree(cwd)
コード例 #3
0
ファイル: model.py プロジェクト: akestner/git-cola
    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."""
        Observable.__init__(self)

        # Initialize the git command object
        self.git = git.instance()

        self.head = 'HEAD'
        self.diff_text = ''
        self.mode = self.mode_none
        self.filename = None
        self.currentbranch = ''
        self.directory = ''
        self.project = ''
        self.remotes = []

        self.commitmsg = ''
        self.modified = []
        self.staged = []
        self.untracked = []
        self.unmerged = []
        self.upstream_changed = []
        self.submodules = set()

        self.local_branches = []
        self.remote_branches = []
        self.tags = []
        if cwd:
            self.set_worktree(cwd)
コード例 #4
0
ファイル: gitcfg.py プロジェクト: kbielefe/git-cola
 def __init__(self):
     self.git = git.instance()
     self._system = {}
     self._user = {}
     self._repo = {}
     self._all = {}
     self._cache_key = None
     self._configs = []
     self._config_files = {}
     self._find_config_files()
コード例 #5
0
ファイル: gitcfg.py プロジェクト: jmvrbanac/git-cola
def _cache_key():
    # Try /etc/gitconfig as a fallback for the system config
    paths = ("/etc/gitconfig", _USER_XDG_CONFIG, _USER_CONFIG, git.instance().git_path("config"))
    mtimes = []
    for path in paths:
        try:
            mtimes.append(core.stat(path).st_mtime)
        except OSError:
            continue
    return mtimes
コード例 #6
0
ファイル: gitcfg.py プロジェクト: jeasu/git-cola
def _cache_key():
    # Try /etc/gitconfig as a fallback for the system config
    paths = ('/etc/gitconfig', _USER_XDG_CONFIG, _USER_CONFIG,
             git.instance().git_path('config'))
    mtimes = []
    for path in paths:
        try:
            mtimes.append(core.stat(path).st_mtime)
        except OSError:
            continue
    return mtimes
コード例 #7
0
ファイル: gitcfg.py プロジェクト: shivas/git-cola
def _cache_key():
    # Try /etc/gitconfig as a fallback for the system config
    userconfig = os.path.expanduser(os.path.join("~", ".gitconfig"))
    paths = ("/etc/gitconfig", userconfig, git.instance().git_path("config"))
    mtimes = []
    for path in paths:
        try:
            mtimes.append(os.stat(path).st_mtime)
        except OSError:
            continue
    return mtimes
コード例 #8
0
ファイル: guicmds.py プロジェクト: dcfrancisco/git-cola
def rebase():
    """Rebase onto a branch."""
    branch = choose_from_combo('Rebase Branch',
                               cola.model().all_branches())
    if not branch:
        return
    #TODO cmd
    status, output = git.instance().rebase(branch,
                                           with_stderr=True,
                                           with_status=True)
    qtutils.log(status, output)
コード例 #9
0
ファイル: compare.py プロジェクト: kbielefe/git-cola
 def __init__(self):
     observable.ObservableModel.__init__(self)
     self.git = git.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
コード例 #10
0
ファイル: gitcfg.py プロジェクト: jeasu/git-cola
def _stat_info():
    # Try /etc/gitconfig as a fallback for the system config
    paths = (('system', '/etc/gitconfig'), ('user', _USER_XDG_CONFIG),
             ('user', _USER_CONFIG), ('repo',
                                      git.instance().git_path('config')))
    statinfo = []
    for category, path in paths:
        try:
            statinfo.append((category, path, core.stat(path).st_mtime))
        except OSError:
            continue
    return statinfo
コード例 #11
0
ファイル: main.py プロジェクト: kbielefe/git-cola
    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 = git.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.untracked = []
        self.unmerged = []
        self.upstream_changed = []
        self.submodules = set()

        #####################################################
        # 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)

        #####################################################
        # Dag
        self._commits = []
コード例 #12
0
ファイル: gitcfg.py プロジェクト: queer1/git-cola
def _stat_info():
    # Try /etc/gitconfig as a fallback for the system config
    userconfig = os.path.expanduser(os.path.join('~', '.gitconfig'))
    paths = (('system', '/etc/gitconfig'),
             ('user', core.decode(userconfig)),
             ('repo', core.decode(git.instance().git_path('config'))))
    statinfo = []
    for category, path in paths:
        try:
            statinfo.append((category, path, os.stat(path).st_mtime))
        except OSError:
            continue
    return statinfo
コード例 #13
0
ファイル: gitcfg.py プロジェクト: queer1/git-cola
def _cache_key():
    # Try /etc/gitconfig as a fallback for the system config
    userconfig = os.path.expanduser(os.path.join('~', '.gitconfig'))
    paths = ('/etc/gitconfig',
             userconfig,
             git.instance().git_path('config'))
    mtimes = []
    for path in paths:
        try:
            mtimes.append(os.stat(path).st_mtime)
        except OSError:
            continue
    return mtimes
コード例 #14
0
ファイル: gitcfg.py プロジェクト: SecuraPaWn/git-cola
def _stat_info():
    # Try /etc/gitconfig as a fallback for the system config
    userconfig = os.path.expanduser(os.path.join('~', '.gitconfig'))
    paths = (('system', '/etc/gitconfig'),
             ('user', core.decode(userconfig)),
             ('repo', core.decode(git.instance().git_path('config'))))
    statinfo = []
    for category, path in paths:
        try:
            statinfo.append((category, path, os.stat(path).st_mtime))
        except OSError:
            continue
    return statinfo
コード例 #15
0
ファイル: gitcfg.py プロジェクト: Acidburn0zzz/git-cola
def _stat_info():
    # Try /etc/gitconfig as a fallback for the system config
    paths = (('system', '/etc/gitconfig'),
             ('user', _USER_XDG_CONFIG),
             ('user', _USER_CONFIG),
             ('repo', git.instance().git_path('config')))
    statinfo = []
    for category, path in paths:
        try:
            statinfo.append((category, path, core.stat(path).st_mtime))
        except OSError:
            continue
    return statinfo
コード例 #16
0
ファイル: gitcfg.py プロジェクト: Avinash-Bhat/git-cola
 def __init__(self):
     observable.Observable.__init__(self)
     self.git = git.instance()
     self._map = {}
     self._system = {}
     self._user = {}
     self._repo = {}
     self._all = {}
     self._cache_key = None
     self._configs = []
     self._config_files = {}
     self._value_cache = {}
     self._attr_cache = {}
     self._find_config_files()
コード例 #17
0
ファイル: gitcfg.py プロジェクト: queer1/git-cola
 def __init__(self):
     observable.Observable.__init__(self)
     self.git = git.instance()
     self._map = {}
     self._system = {}
     self._user = {}
     self._repo = {}
     self._all = {}
     self._cache_key = None
     self._configs = []
     self._config_files = {}
     self._value_cache = {}
     self._attr_cache = {}
     self._find_config_files()
コード例 #18
0
ファイル: gitcfg.py プロジェクト: jmvrbanac/git-cola
def _stat_info():
    # Try /etc/gitconfig as a fallback for the system config
    paths = (
        ("system", "/etc/gitconfig"),
        ("user", _USER_XDG_CONFIG),
        ("user", _USER_CONFIG),
        ("repo", git.instance().git_path("config")),
    )
    statinfo = []
    for category, path in paths:
        try:
            statinfo.append((category, path, core.stat(path).st_mtime))
        except OSError:
            continue
    return statinfo
コード例 #19
0
ファイル: gitcfg.py プロジェクト: shivas/git-cola
def _stat_info():
    # Try /etc/gitconfig as a fallback for the system config
    userconfig = os.path.expanduser(os.path.join("~", ".gitconfig"))
    paths = (
        ("system", "/etc/gitconfig"),
        ("user", core.decode(userconfig)),
        ("repo", core.decode(git.instance().git_path("config"))),
    )
    statinfo = []
    for category, path in paths:
        try:
            statinfo.append((category, path, os.stat(path).st_mtime))
        except OSError:
            continue
    return statinfo
コード例 #20
0
ファイル: guicmds.py プロジェクト: kbielefe/git-cola
def diff_branch():
    """Launches a diff against a branch."""
    branch = choose_from_combo('Select Branch, Tag, or Commit-ish',
                               ['HEAD^'] +
                               cola.model().all_branches() +
                               cola.model().tags)
    if not branch:
        return
    zfiles_str = git.instance().diff(branch, name_only=True,
                                     no_color=True,
                                     z=True).rstrip('\0')
    files = zfiles_str.split('\0')
    filename = choose_from_list('Select File', files)
    if not filename:
        return
    cola.notifier().broadcast(signals.branch_mode, branch, filename)
コード例 #21
0
ファイル: compare.py プロジェクト: kbielefe/git-cola
 def __init__(self):
     observable.ObservableModel.__init__(self)
     self.git = git.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 = []
コード例 #22
0
ファイル: version.py プロジェクト: dcfrancisco/git-cola
def git_version():
    """Returns the current GIT version"""
    return git.instance().version().split()[-1]
コード例 #23
0
ファイル: repobrowser.py プロジェクト: kbielefe/git-cola

import os

from PyQt4 import QtGui

from cola import git
from cola import gitcmds
from cola import utils
from cola import resources
from cola import qtutils
from cola.models import browser
from cola.views.selectcommits import SelectCommitsView
from cola.qobserver import QObserver

git = git.instance()


def select_file_from_repo():
    """Launch a dialog for selecting a filename from a branch."""
    # Clone the model to allow opening multiple browsers
    # with different sets of data
    model = browser.BrowserModel(gitcmds.current_branch())
    parent = QtGui.QApplication.instance().activeWindow()
    view = SelectCommitsView(parent, syntax=False)
    controller = RepoBrowserController(model, view,
                                       title='Select File',
                                       get_file=True)
    view.show()
    if view.exec_() == QtGui.QDialog.Accepted:
        return controller.filename