Beispiel #1
0
import cola
from cola import i18n
from cola import core
from cola import errors
from cola import gitcfg
from cola import gitcmds
from cola import utils
from cola import signals
from cola import cmdfactory
from cola import difftool
from cola import version
from cola.diffparse import DiffParser
from cola.models import selection

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


class Command(object):
    """Base class for all commands; provides the command pattern."""
    def __init__(self):
        """Initialize the command and stash away values for use in do()"""
        # These are commonly used so let's make it easier to write new commands.
        self.undoable = False
        self.model = cola.model()

        self.old_diff_text = self.model.diff_text
        self.old_filename = self.model.filename
        self.old_mode = self.model.mode
        self.old_head = self.model.head
Beispiel #2
0
import cola
from cola import i18n
from cola import core
from cola import errors
from cola import gitcfg
from cola import gitcmds
from cola import utils
from cola import signals
from cola import cmdfactory
from cola import difftool
from cola.diffparse import DiffParser
from cola.models import selection

_notifier = cola.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__
Beispiel #3
0
 def __init__(self):
     BaseCommand.__init__(self)
     self.factory = cmdfactory.factory()
Beispiel #4
0
 def __init__(self):
     BaseCommand.__init__(self)
     self.factory = cmdfactory.factory()