# 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
            # Fail if no remotes is OK.

            if self.get_remotes():
                raise

    def add_remote(self, address: str, *, alias: str = 'origin'):
        """Adds a remote repository.
        
        :param address:
        :param alias:

        """
        self.remote = address

    def push(self, *, upstream: Union[bool, str] = None):
        """Pushes local changes and tags to remote.
        
        :param upstream: Upstream alias. If True, default name is used.

        """
        if upstream:

            if upstream is True:
                upstream = self.UPSTREAM

            self.run_command(f'push -u {upstream} {self.MASTER}')

        else:
            self.run_command('push')


# 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

            # Fail if no remotes is OK.

            if self.get_remotes():
                raise

    def add_remote(self, address: str, *, alias: str = 'origin'):
        """Adds a remote repository.
        
        :param address:
        :param alias:

        """
        self.remote = address

    def push(self, *, upstream: Union[bool, str] = None):
        """Pushes local changes and tags to remote.
        
        :param upstream: Upstream alias. If True, default name is used.

        """
        if upstream:

            if upstream is True:
                upstream = self.UPSTREAM

            self.run_command(f'push -u {upstream} {self.MASTER}')

        else:
            self.run_command('push')


        self.run_command('push --tags')