Esempio n. 1
0
class BaseHaskiAction(object):
    """This class is the abstract base class for Haski tasks.
    """
    __metaclass__ = ABCMeta

    def __init__(self):
        self._repository = Repository()

    @abstractmethod
    def __call__(self, namespace):
        """This method is invoked by argparse and should do the actuall work.
        By default, it is abstract and does nothing, so it forces you to
        implement it.
        """
        pass

    def get_commit(self, namespace):
        """This function gets the commit wanted commit on which an action is to
        be performed.
        """
        commit = self._repository.get_commit(namespace.revision)
        return commit

    def get_repository_location(self):
        """Returns the directory where this repository is located.
        """
        return self._repository.get_path()