# 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

@pytest.fixture
def temp_hg_dir(temp_empty_hg_dir, safe_devnull):
    with open(os.path.join(temp_empty_hg_dir, "README.md"), "w") as f:
        f.writelines(["# Test file", "This is just a test file for punch"])

    subprocess.check_call(["hg", "add", "README.md"],
                          cwd=temp_empty_hg_dir, stdout=safe_devnull)
    subprocess.check_call(["hg", "commit", "-m", "Initial addition"],
                          cwd=temp_empty_hg_dir, stdout=safe_devnull)

    return temp_empty_hg_dir


@pytest.fixture
def temp_hg_dir_other_branch(temp_hg_dir):
    hg_repo_add_branch(temp_hg_dir, "other")
    hg_repo_change_branch(temp_hg_dir, hr.HgRepo.DEFAULT_BRANCH)
    return temp_hg_dir


@pytest.fixture
def empty_vcs_configuration():
    return vc.VCSConfiguration(
        'hg', {}, {}, {'current_version': 'a', 'new_version': 'b'}
    )


@pytest.fixture
def other_branch_vcs_configuration():

# 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


@pytest.fixture
def temp_hg_dir(temp_empty_hg_dir, safe_devnull):
    with open(os.path.join(temp_empty_hg_dir, "README.md"), "w") as f:
        f.writelines(["# Test file", "This is just a test file for punch"])

    subprocess.check_call(["hg", "add", "README.md"],
                          cwd=temp_empty_hg_dir, stdout=safe_devnull)
    subprocess.check_call(["hg", "commit", "-m", "Initial addition"],
                          cwd=temp_empty_hg_dir, stdout=safe_devnull)

    return temp_empty_hg_dir


@pytest.fixture
def temp_hg_dir_other_branch(temp_hg_dir):
    hg_repo_add_branch(temp_hg_dir, "other")
    hg_repo_change_branch(temp_hg_dir, hr.HgRepo.DEFAULT_BRANCH)
    return temp_hg_dir


@pytest.fixture
def empty_vcs_configuration():
    return vc.VCSConfiguration(
        'hg', {}, {}, {'current_version': 'a', 'new_version': 'b'}
    )


@pytest.fixture
def other_branch_vcs_configuration():

    return vc.VCSConfiguration(