| 611 | |
| 612 | |
| 613 | def test_revert(testrepo: Repository) -> None: |
| 614 | hello_txt = Path(testrepo.workdir) / 'hello.txt' |
| 615 | commit_to_revert = testrepo['4ec4389a8068641da2d6578db0419484972284c8'] |
| 616 | assert isinstance(commit_to_revert, Commit) |
| 617 | |
| 618 | assert testrepo.state() == RepositoryState.NONE |
| 619 | assert not testrepo.message |
| 620 | assert 'bonjour le monde' in hello_txt.read_text() |
| 621 | |
| 622 | # Revert addition of French line in hello.txt |
| 623 | testrepo.revert(commit_to_revert) |
| 624 | |
| 625 | assert 'bonjour le monde' not in hello_txt.read_text() |
| 626 | assert testrepo.status()['hello.txt'] == FileStatus.INDEX_MODIFIED |
| 627 | assert testrepo.state() == RepositoryState.REVERT |
| 628 | assert ( |
| 629 | testrepo.message |
| 630 | == f'Revert "Say hello in French"\n\nThis reverts commit {commit_to_revert.id}.\n' |
| 631 | ) |
| 632 | |
| 633 | |
| 634 | def test_default_signature(testrepo: Repository) -> None: |