MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_revert

Function test_revert

test/test_repository.py:613–631  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

611
612
613def 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
634def test_default_signature(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 3

stateMethod · 0.80
revertMethod · 0.80
statusMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…