Exemplo n.º 1
0
def tracked_branch(branch=None, config=None):
    """Return the remote branch associated with 'branch'."""
    if config is None:
        config = gitcfg.instance()
    if branch is None:
        branch = current_branch()
    if branch is None:
        return None
    remote = config.get('branch.%s.remote' % branch)
    if not remote:
        return None
    merge_ref = config.get('branch.%s.merge' % branch)
    if not merge_ref:
        return None
    refs_heads = 'refs/heads/'
    if merge_ref.startswith(refs_heads):
        return remote + '/' + merge_ref[len(refs_heads):]
    return None
Exemplo n.º 2
0
import core
import errors
import gitcfg
import gitcmds
import utils
import signals
import cmdfactory
#from cola import difftool
#from cola.diffparse import DiffParser
#from cola.models import selection

import notification

_notifier = notification.notifier()
_factory = cmdfactory.factory()
_config = gitcfg.instance()


class BaseCommand(object):
    """Base class for all commands; provides the command pattern"""
    def __init__(self):
        self.undoable = False

    def is_undoable(self):
        """Can this be undone?"""
        return self.undoable

    def name(self):
        """Return this command's name."""
        return self.__class__.__name__
Exemplo n.º 3
0
def default_remote(config=None):
    """Return the remote tracked by the current branch."""
    if config is None:
        config = gitcfg.instance()
    return config.get('branch.%s.remote' % current_branch())