fetch: add ability to fetch into a remote tracking branch
[git-cola.git] / cola / cmd.py
blob60a2ecb4207fdc84677ee3d5fd35e5807fda534f
1 """Base Command class"""
4 class Command:
5 """Mixin interface for commands"""
7 UNDOABLE = False
9 @staticmethod
10 def name():
11 """Return the command's name"""
12 return '(undefined)'
14 @classmethod
15 def is_undoable(cls):
16 """Can this be undone?"""
17 return cls.UNDOABLE
19 def do(self):
20 """Execute the command"""
21 return
23 def undo(self):
24 """Undo the command"""
25 return
28 class ContextCommand(Command):
29 """Base class for commands that operate on a context"""
31 def __init__(self, context):
32 self.context = context
33 self.model = context.model
34 self.cfg = context.cfg
35 self.git = context.git
36 self.selection = context.selection
37 self.fsmonitor = context.fsmonitor