예제 #1
0
파일: __init__.py 프로젝트: jonashaag/vcs
def get_backend(alias):
    """
    Returns ``Repository`` class identified by the given alias or raises
    VCSError if alias is not recognized or backend class cannot be imported.
    """
    if alias not in settings.BACKENDS:
        raise VCSError("Given alias '%s' is not recognized! Allowed aliases:\n"
            "%s" % (alias, pformat(settings.BACKENDS.keys())))
    backend_path = settings.BACKENDS[alias]
    klass = import_class(backend_path)
    return klass
예제 #2
0
def get_backend(alias):
    """
    Returns ``Repository`` class identified by the given alias or raises
    VCSError if alias is not recognized or backend class cannot be imported.
    """
    if alias not in settings.BACKENDS:
        raise VCSError("Given alias '%s' is not recognized! Allowed aliases:\n"
                       "%s" % (alias, pformat(settings.BACKENDS.keys())))
    backend_path = settings.BACKENDS[alias]
    klass = import_class(backend_path)
    return klass
예제 #3
0
파일: cli.py 프로젝트: vchalapureddi/vcs
    def get_command_class(self, cmd):
        """
        Returns command class from the registry for a given ``cmd``.

        :param cmd: command to run (key at the registry)
        """
        try:
            cmdpath = self.registry[cmd]
        except KeyError:
            raise CommandError("No such command %r" % cmd)
        if isinstance(cmdpath, basestring):
            Command = import_class(cmdpath)
        else:
            Command = cmdpath
        return Command
예제 #4
0
파일: cli.py 프로젝트: jonashaag/vcs
    def get_command_class(self, cmd):
        """
        Returns command class from the registry for a given ``cmd``.

        :param cmd: command to run (key at the registry)
        """
        try:
            cmdpath = self.registry[cmd]
        except KeyError:
            raise CommandError("No such command %r" % cmd)
        if isinstance(cmdpath, basestring):
            Command = import_class(cmdpath)
        else:
            Command = cmdpath
        return Command
예제 #5
0
파일: cli.py 프로젝트: lukaszb/vcs
 def get_command_class(self, cmd):
     cmdpath = registry[cmd]
     Command = import_class(cmdpath)
     return Command