# Path: makeapp/exceptions.py
# class ProjectorExeption(MakeappException):
#     """Basic Projector related exception."""
# 
# class CommandError(MakeappException):
#     """Raised when projector detects external process invocation error."""
# 
# Path: makeapp/utils.py
# def run_command(command: str, *, err_msg: str = '') -> List[str]:
#     """Runs a command in a shell process.
# 
#     Returns a list of strings gathered from a command.
# 
#     :param command:
# 
#     :param err_msg: Message to show on error.
# 
#     :raises: CommandError
# 
#     """
#     prc = Popen(command, stdout=PIPE, stderr=STDOUT, shell=True, universal_newlines=True)
# 
#     LOG.debug(f'Run command: `{command}` ...')
# 
#     data = []
# 
#     out, _ = prc.communicate()
# 
#     if isinstance(out, bytes):
#         out = out.decode('utf-8')
# 
#     has_error = prc.returncode
# 
#     for item in out.splitlines():
#         item = item.strip()
# 
#         if not item:
#             continue
# 
#         data.append(item)
# 
#     if has_error:
#         raise CommandError(err_msg or f"Command `{command}` failed: %s" % '\n'.join(data))
# 
#     return data


import os
from tempfile import NamedTemporaryFile
from typing import Optional, List, Union
from ..exceptions import ProjectorExeption, CommandError
from ..utils import run_command

    @classmethod
    def get_backends(cls) -> dict:
        """Returns available backends."""

        backends = {}

        for backend in (GitHelper, MercurialHelper):
            backends[backend.COMMAND] = backend

        return backends

    @classmethod
    def get(cls, vcs_path: Optional[str] = None) -> 'VcsHelper':
        """Returns an appropriate VCS helper object.
        
        :param vcs_path: Repository dir

        """
        vcs_path = vcs_path or os.getcwd()

        helper = None

        for helper_cls in cls.get_backends().values():
            if os.path.exists(os.path.join(vcs_path, f'.{helper_cls.COMMAND}')):
                helper = helper_cls()
                break

        return helper


# Path: makeapp/exceptions.py
# class ProjectorExeption(MakeappException):
#     """Basic Projector related exception."""
# 
# class CommandError(MakeappException):
#     """Raised when projector detects external process invocation error."""
# 
# Path: makeapp/utils.py
# def run_command(command: str, *, err_msg: str = '') -> List[str]:
#     """Runs a command in a shell process.
# 
#     Returns a list of strings gathered from a command.
# 
#     :param command:
# 
#     :param err_msg: Message to show on error.
# 
#     :raises: CommandError
# 
#     """
#     prc = Popen(command, stdout=PIPE, stderr=STDOUT, shell=True, universal_newlines=True)
# 
#     LOG.debug(f'Run command: `{command}` ...')
# 
#     data = []
# 
#     out, _ = prc.communicate()
# 
#     if isinstance(out, bytes):
#         out = out.decode('utf-8')
# 
#     has_error = prc.returncode
# 
#     for item in out.splitlines():
#         item = item.strip()
# 
#         if not item:
#             continue
# 
#         data.append(item)
# 
#     if has_error:
#         raise CommandError(err_msg or f"Command `{command}` failed: %s" % '\n'.join(data))
# 
#     return data


# Path: makeapp/helpers/vcs.py
import os
from tempfile import NamedTemporaryFile
from typing import Optional, List, Union
from ..exceptions import ProjectorExeption, CommandError
from ..utils import run_command


    @classmethod
    def get_backends(cls) -> dict:
        """Returns available backends."""

        backends = {}

        for backend in (GitHelper, MercurialHelper):
            backends[backend.COMMAND] = backend

        return backends

    @classmethod
    def get(cls, vcs_path: Optional[str] = None) -> 'VcsHelper':
        """Returns an appropriate VCS helper object.
        
        :param vcs_path: Repository dir

        """
        vcs_path = vcs_path or os.getcwd()

        helper = None

        for helper_cls in cls.get_backends().values():
            if os.path.exists(os.path.join(vcs_path, f'.{helper_cls.COMMAND}')):
                helper = helper_cls()
                break

        return helper


    def run_command(self, command):