Finds commit with given frid mentioned in the commit message and checks out that commit. If frid argument is not provided (None), repo is checked out to the initial state. In case the base folder doesn't exist, code is checked out to the initial repo commit. Otherwise, the repo is chec
(repo_path: Union[str, os.PathLike], frid: Optional[str] = None)
| 167 | |
| 168 | |
| 169 | def checkout_commit_with_frid(repo_path: Union[str, os.PathLike], frid: Optional[str] = None) -> Repo: |
| 170 | """ |
| 171 | Finds commit with given frid mentioned in the commit message and checks out that commit. |
| 172 | |
| 173 | If frid argument is not provided (None), repo is checked out to the initial state. In case the base folder doesn't exist, |
| 174 | code is checked out to the initial repo commit. Otherwise, the repo is checked out to the base folder commit. |
| 175 | |
| 176 | It is expected that the repo has at least one commit related to provided frid if frid is not None. |
| 177 | In case the frid related commit is not found, an exception is raised. |
| 178 | """ |
| 179 | repo = Repo(repo_path) |
| 180 | |
| 181 | commit = _get_commit(repo, frid) |
| 182 | |
| 183 | if not commit: |
| 184 | raise InvalidGitRepositoryError("Git repository is in an invalid state. Relevant commit could not be found.") |
| 185 | |
| 186 | repo.git.checkout(commit) |
| 187 | return repo |
| 188 | |
| 189 | |
| 190 | def checkout_previous_branch(repo_path: Union[str, os.PathLike]) -> Repo: |
nothing calls this directly
no test coverage detected