# Path: punch/vcs_configuration.py
# class VCSConfiguration(object):
#     def __init__(self, name, options, global_variables, special_variables,
#                  commit_message=None, finish_release=True,
#                  include_files=None, include_all_files=False):
#     def from_dict(cls, vcs_configuration_dict,
#                   global_variables, special_variables):
# 
# Path: punch/vcs_repositories/git_repo.py
# class GitRepo(vr.VCSRepo):
#     def __init__(self, working_path, config_obj, files_to_commit=None):
#     def _check_config(self):
#     def _check_system(self):
#     def _set_command(self):
#     def get_current_branch(self):
#     def get_tags(self):
#     def get_branches(self):
#     def pre_start_release(self):
#     def start_release(self):
#     def finish_release(self):
#     def post_finish_release(self):
#     def tag(self, tag_name):
#     def get_info(self):
# 
# Path: punch/vcs_repositories/exceptions.py
# class RepositoryError(Exception):
# class RepositoryWorkflowError(RepositoryError):
# class RepositorySystemError(RepositoryError):
# class RepositoryConfigurationError(RepositoryError):
# class RepositoryStatusError(RepositoryError):


import subprocess
import os
import pytest
from punch import vcs_configuration as vc
from punch.vcs_repositories import git_repo as gr, exceptions as re
    repo.pre_start_release()
    repo.start_release()
    assert release_name in repo.get_branches()

    with open(os.path.join(temp_git_dir, "version.txt"), "w") as f:
        f.writelines([release_name])

    subprocess.check_call(
        ["git", "add", "version.txt"],
        cwd=temp_git_dir,
        stdout=safe_devnull,
        stderr=safe_devnull
    )

    repo.finish_release()

    p = subprocess.Popen(["git", "log"], cwd=temp_git_dir,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()
    assert commit_message in stdout.decode('utf8')

    assert release_name in repo.get_tags()
    assert release_name not in repo.get_branches()


def test_finish_release_with_custom_tag(temp_git_dir, safe_devnull):
    release_name = "1.0"
    commit_message = "A commit message"
    tag = "Version_{}".format(release_name)


# Path: punch/vcs_configuration.py
# class VCSConfiguration(object):
#     def __init__(self, name, options, global_variables, special_variables,
#                  commit_message=None, finish_release=True,
#                  include_files=None, include_all_files=False):
#     def from_dict(cls, vcs_configuration_dict,
#                   global_variables, special_variables):
# 
# Path: punch/vcs_repositories/git_repo.py
# class GitRepo(vr.VCSRepo):
#     def __init__(self, working_path, config_obj, files_to_commit=None):
#     def _check_config(self):
#     def _check_system(self):
#     def _set_command(self):
#     def get_current_branch(self):
#     def get_tags(self):
#     def get_branches(self):
#     def pre_start_release(self):
#     def start_release(self):
#     def finish_release(self):
#     def post_finish_release(self):
#     def tag(self, tag_name):
#     def get_info(self):
# 
# Path: punch/vcs_repositories/exceptions.py
# class RepositoryError(Exception):
# class RepositoryWorkflowError(RepositoryError):
# class RepositorySystemError(RepositoryError):
# class RepositoryConfigurationError(RepositoryError):
# class RepositoryStatusError(RepositoryError):


# Path: tests/vcs_repositories/test_git_repo.py
import subprocess
import os
import pytest
from punch import vcs_configuration as vc
from punch.vcs_repositories import git_repo as gr, exceptions as re

    repo.pre_start_release()
    repo.start_release()
    assert release_name in repo.get_branches()

    with open(os.path.join(temp_git_dir, "version.txt"), "w") as f:
        f.writelines([release_name])

    subprocess.check_call(
        ["git", "add", "version.txt"],
        cwd=temp_git_dir,
        stdout=safe_devnull,
        stderr=safe_devnull
    )

    repo.finish_release()

    p = subprocess.Popen(["git", "log"], cwd=temp_git_dir,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()
    assert commit_message in stdout.decode('utf8')

    assert release_name in repo.get_tags()
    assert release_name not in repo.get_branches()


def test_finish_release_with_custom_tag(temp_git_dir, safe_devnull):
    release_name = "1.0"
    commit_message = "A commit message"
    tag = "Version_{}".format(release_name)


    config = vc.VCSConfiguration(