def test_git_server_change_repo_branch(workspace_path: Path, git_server: GitServer) -> None: foo_url = git_server.add_repo("foo") git_server.change_repo_branch("foo", "devel") git_server.push_file("foo", "devel.txt", contents="this is devel\n") tsrc.git.run(workspace_path, "clone", foo_url, "--branch", "devel") foo_path = workspace_path / "foo" assert (foo_path / "devel.txt").text() == "this is devel\n"
def test_changing_branch(tsrc_cli: CLI, git_server: GitServer, workspace_path: Path, message_recorder: MessageRecorder) -> None: git_server.add_repo("foo") manifest_url = git_server.manifest_url tsrc_cli.run("init", manifest_url) git_server.change_repo_branch("foo", "next") git_server.push_file("foo", "next.txt") git_server.manifest.set_repo_branch("foo", "next") tsrc_cli.run("sync", expect_fail=True) assert message_recorder.find("not on the correct branch")
def test_uses_correct_branch_for_repo(tsrc_cli: CLI, git_server: GitServer, workspace_path: Path) -> None: git_server.add_repo("foo") git_server.change_repo_branch("foo", "next") git_server.push_file("foo", "next.txt") git_server.manifest.set_repo_branch("foo", "next") manifest_url = git_server.manifest_url tsrc_cli.run("init", manifest_url) foo_path = workspace_path / "foo" assert tsrc.git.get_current_branch(foo_path) == "next"