def setUp(self) -> None: if os.path.exists(REPO_NAME): shutil.rmtree(REPO_NAME, onerror=set_write_permission_and_retry) logger.info(f"Does {REPO_NAME} exist: {os.path.exists(REPO_NAME)}") repo = Repository( REPO_NAME, clone_from=f"{USER}/{REPO_NAME}", use_auth_token=self._token, git_user="******", git_email="*****@*****.**", ) with repo.commit("Add file to main branch"): with open("dummy_file.txt", "w+") as f: f.write("v1") self.first_commit_hash = repo.git_head_hash() with repo.commit("Add file to main branch"): with open("dummy_file.txt", "w+") as f: f.write("v2") with open("dummy_file_2.txt", "w+") as f: f.write("v3") self.second_commit_hash = repo.git_head_hash() with repo.commit("Add file to other branch", branch="other"): with open("dummy_file_2.txt", "w+") as f: f.write("v4") self.third_commit_hash = repo.git_head_hash()
def setUp(self) -> None: repo = Repository( REPO_NAME, clone_from=f"{USER}/{REPO_NAME}", use_auth_token=self._token, git_user="******", git_email="*****@*****.**", ) with repo.commit("Add file to main branch"): with open("dummy_file.txt", "w+") as f: f.write("v1") self.first_commit_hash = repo.git_head_hash() with repo.commit("Add file to main branch"): with open("dummy_file.txt", "w+") as f: f.write("v2") with open("dummy_file_2.txt", "w+") as f: f.write("v3") self.second_commit_hash = repo.git_head_hash() with repo.commit("Add file to other branch", branch="other"): with open("dummy_file_2.txt", "w+") as f: f.write("v4") self.third_commit_hash = repo.git_head_hash()