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

Function test_checkout_ref

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

Source from the content-addressed store, hash-verified

88
89
90def test_checkout_ref(testrepo: Repository) -> None:
91 ref_i18n = testrepo.lookup_reference('refs/heads/i18n')
92
93 # checkout i18n with conflicts and default strategy should
94 # not be possible
95 with pytest.raises(pygit2.GitError):
96 testrepo.checkout(ref_i18n)
97
98 # checkout i18n with GIT_CHECKOUT_FORCE
99 head_object = testrepo.head
100 head = testrepo[head_object.target]
101 assert 'new' not in head.tree
102 testrepo.checkout(ref_i18n, strategy=CheckoutStrategy.FORCE)
103
104 head_object = testrepo.head
105 head = testrepo[head_object.target]
106 assert head.id == ref_i18n.target
107 assert 'new' in head.tree
108 assert 'bye.txt' not in testrepo.status()
109
110
111def test_checkout_callbacks(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

checkoutMethod · 0.80
statusMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…