# 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/hg_repo.py
# class HgRepo(vr.VCSRepo):
#     DEFAULT_BRANCH = 'default'
#     def __init__(self, working_path, config_obj, files_to_commit=None):
#     def get_current_branch(self):
#     def get_branches(self):
#     def get_tags(self):
#     def get_summary(self):
#     def pre_start_release(self):
#     def start_release(self):
#     def finish_release(self):
#     def tag(self, tag):
#     def _recover_branch(self):
#     def _change_branch(self, branch):
#     def _check_config(self):
#     def _check_system(self):
#     def _set_command(self):
#     def _is_clean(self):
#     def _parse_branch_line(cls, line):
#     def _configured_tag(self):
#     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
import sys
from six.moves import configparser
from punch import vcs_configuration as vc
from punch.vcs_repositories import hg_repo as hr, exceptions as re
    assert release_name not in ready_to_finish_repo.get_branches()


def test_finish_write_tag(ready_to_finish_repo):
    config = ready_to_finish_repo.config_obj
    release_name = config.options['new_version']

    ready_to_finish_repo.finish_release()

    assert release_name in ready_to_finish_repo.get_tags()


# def test_finish_release_with_custom_tag(temp_hg_dir, ready_to_finish_repo):
#     tag = "Version_{}".format("1.0")
#     ready_to_finish_repo.config_obj.options[tag] = tag
#     ready_to_finish_repo.finish_release()

#     assert tag in ready_to_finish_repo.get_tags()


def test_finish_release_custom_tag_cannot_contain_spaces(temp_hg_dir):
    release_name = "1.0"
    commit_message = "A commit message"
    tag = "Version {}".format(release_name)

    config = vc.VCSConfiguration('hg', {'tag': tag}, global_variables={},
                                 special_variables={
                                     'new_version': release_name},
                                 commit_message=commit_message)


# 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/hg_repo.py
# class HgRepo(vr.VCSRepo):
#     DEFAULT_BRANCH = 'default'
#     def __init__(self, working_path, config_obj, files_to_commit=None):
#     def get_current_branch(self):
#     def get_branches(self):
#     def get_tags(self):
#     def get_summary(self):
#     def pre_start_release(self):
#     def start_release(self):
#     def finish_release(self):
#     def tag(self, tag):
#     def _recover_branch(self):
#     def _change_branch(self, branch):
#     def _check_config(self):
#     def _check_system(self):
#     def _set_command(self):
#     def _is_clean(self):
#     def _parse_branch_line(cls, line):
#     def _configured_tag(self):
#     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_hg_repo.py
import subprocess
import os
import pytest
import sys
from six.moves import configparser
from punch import vcs_configuration as vc
from punch.vcs_repositories import hg_repo as hr, exceptions as re

    assert release_name not in ready_to_finish_repo.get_branches()


def test_finish_write_tag(ready_to_finish_repo):
    config = ready_to_finish_repo.config_obj
    release_name = config.options['new_version']

    ready_to_finish_repo.finish_release()

    assert release_name in ready_to_finish_repo.get_tags()


# def test_finish_release_with_custom_tag(temp_hg_dir, ready_to_finish_repo):
#     tag = "Version_{}".format("1.0")
#     ready_to_finish_repo.config_obj.options[tag] = tag
#     ready_to_finish_repo.finish_release()

#     assert tag in ready_to_finish_repo.get_tags()


def test_finish_release_custom_tag_cannot_contain_spaces(temp_hg_dir):
    release_name = "1.0"
    commit_message = "A commit message"
    tag = "Version {}".format(release_name)

    config = vc.VCSConfiguration('hg', {'tag': tag}, global_variables={},
                                 special_variables={
                                     'new_version': release_name},
                                 commit_message=commit_message)


    with pytest.raises(re.RepositoryConfigurationError):