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

Function test_revert_commit

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

Source from the content-addressed store, hash-verified

594
595
596def test_revert_commit(testrepo: Repository) -> None:
597 master = testrepo.head.peel()
598 assert isinstance(master, Commit)
599 commit_to_revert = testrepo['4ec4389a8068641da2d6578db0419484972284c8']
600 assert isinstance(commit_to_revert, Commit)
601
602 parent = commit_to_revert.parents[0]
603 commit_diff_stats = parent.tree.diff_to_tree(commit_to_revert.tree).stats
604
605 revert_index = testrepo.revert_commit(commit_to_revert, master)
606 revert_diff_stats = revert_index.diff_to_tree(master.tree).stats
607
608 assert revert_diff_stats.insertions == commit_diff_stats.deletions
609 assert revert_diff_stats.deletions == commit_diff_stats.insertions
610 assert revert_diff_stats.files_changed == commit_diff_stats.files_changed
611
612
613def test_revert(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

diff_to_treeMethod · 0.80
revert_commitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…