Example #1
0
def find_repository_searches_ancestors_for_working_directory():
    with temporary_directory() as directory:
        repository_path = os.path.join(directory, ".git")
        search_path = os.path.join(directory, "one/two/three")
        mkdir_p(repository_path)
        mkdir_p(search_path)
        repository = find_repository(search_path)
        assert_equal(directory, repository.working_directory)
Example #2
0
def find_repository_searches_ancestors_for_working_directory():
    with temporary_directory() as directory:
        repository_path = os.path.join(directory, ".git")
        search_path = os.path.join(directory, "one/two/three")
        mkdir_p(repository_path)
        mkdir_p(search_path)
        repository = find_repository(search_path)
        assert_equal(directory, repository.working_directory)
Example #3
0
def find_repository_returns_git_repository_if_path_is_root_of_git_repository():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".git"))
        repository = find_repository(directory)
        assert_equal("git", repository.type)
Example #4
0
def working_directory_of_git_repository_is_directory_above_hidden_directory():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".git"))
        repository = repository_at(directory)
        assert_equal(directory, repository.working_directory)
Example #5
0
def hg_repository_is_returned_if_path_is_root_of_hg_repository():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".hg"))
        repository = repository_at(directory)
        assert_equal("hg", repository.type)
Example #6
0
def git_repository_is_returned_if_path_is_working_directory_of_git_repository(
):
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".git"))
        repository = repository_at(directory)
        assert_equal("git", repository.type)
Example #7
0
def find_repository_returns_git_repository_if_path_is_root_of_git_repository():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".git"))
        repository = find_repository(directory)
        assert_equal("git", repository.type)
Example #8
0
def working_directory_of_git_repository_is_directory_above_hidden_directory():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".git"))
        repository = repository_at(directory)
        assert_equal(directory, repository.working_directory)
Example #9
0
def hg_repository_is_returned_if_path_is_root_of_hg_repository():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".hg"))
        repository = repository_at(directory)
        assert_equal("hg", repository.type)
Example #10
0
def git_repository_is_returned_if_path_is_working_directory_of_git_repository():
    with temporary_directory() as directory:
        mkdir_p(os.path.join(directory, ".git"))
        repository = repository_at(directory)
        assert_equal("git", repository.type)