# Path: punch/vcs_repositories/exceptions.py
# class RepositoryError(Exception):
# class RepositoryWorkflowError(RepositoryError):
# class RepositorySystemError(RepositoryError):
# class RepositoryConfigurationError(RepositoryError):
# class RepositoryStatusError(RepositoryError):
# 
# Path: punch/vcs_repositories/vcs_repo.py
# class VCSRepo(object):  # pragma: nocover
#     def __init__(self, working_path, config_obj, files_to_commit=None):
#     def _check_config(self):
#     def _set_command(self):
#     def _check_system(self):
#     def _run(self, command_line, error_message=None):
#     def pre_start_release(self):
#     def start_release(self):
#     def finish_release(self):
#     def post_finish_release(self):


import os
import six
from punch.vcs_repositories import exceptions as e
from punch.vcs_repositories import vcs_repo as vr
    def _set_command(self):
        self.commands = ['git']
        self.command = 'git'

    def get_current_branch(self):
        stdout = self._run([self.command, "rev-parse", "--abbrev-ref", "HEAD"])

        branch = stdout.replace("\n", "")

        return branch

    def get_tags(self):
        return self._run([self.command, "tag"])

    def get_branches(self):
        return self._run([self.command, "branch"])

    def pre_start_release(self):
        output = self._run([self.command, "status"])
        if "Changes to be committed:" in output:
            raise e.RepositoryStatusError(
                ("Cannot checkout the target branch while repository "
                 "contains uncommitted changes")
            )

        self._run([self.command, "checkout", self.target_branch])

        branch = self.get_current_branch()

        if branch != self.target_branch:

# Path: punch/vcs_repositories/exceptions.py
# class RepositoryError(Exception):
# class RepositoryWorkflowError(RepositoryError):
# class RepositorySystemError(RepositoryError):
# class RepositoryConfigurationError(RepositoryError):
# class RepositoryStatusError(RepositoryError):
# 
# Path: punch/vcs_repositories/vcs_repo.py
# class VCSRepo(object):  # pragma: nocover
#     def __init__(self, working_path, config_obj, files_to_commit=None):
#     def _check_config(self):
#     def _set_command(self):
#     def _check_system(self):
#     def _run(self, command_line, error_message=None):
#     def pre_start_release(self):
#     def start_release(self):
#     def finish_release(self):
#     def post_finish_release(self):


# Path: punch/vcs_repositories/git_repo.py
import os
import six
from punch.vcs_repositories import exceptions as e
from punch.vcs_repositories import vcs_repo as vr

    def _set_command(self):
        self.commands = ['git']
        self.command = 'git'

    def get_current_branch(self):
        stdout = self._run([self.command, "rev-parse", "--abbrev-ref", "HEAD"])

        branch = stdout.replace("\n", "")

        return branch

    def get_tags(self):
        return self._run([self.command, "tag"])

    def get_branches(self):
        return self._run([self.command, "branch"])

    def pre_start_release(self):
        output = self._run([self.command, "status"])
        if "Changes to be committed:" in output:
            raise e.RepositoryStatusError(
                ("Cannot checkout the target branch while repository "
                 "contains uncommitted changes")
            )

        self._run([self.command, "checkout", self.target_branch])

        branch = self.get_current_branch()

        if branch != self.target_branch:

            raise e.RepositoryStatusError(