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

Function test_checkout_branch

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

Source from the content-addressed store, hash-verified

210
211
212def test_checkout_branch(testrepo: Repository) -> None:
213 branch_i18n = testrepo.lookup_branch('i18n')
214
215 # checkout i18n with conflicts and default strategy should
216 # not be possible
217 with pytest.raises(pygit2.GitError):
218 testrepo.checkout(branch_i18n)
219
220 # checkout i18n with GIT_CHECKOUT_FORCE
221 head_object = testrepo.head
222 head = testrepo[head_object.target]
223 assert 'new' not in head.tree
224 testrepo.checkout(branch_i18n, strategy=CheckoutStrategy.FORCE)
225
226 head_object = testrepo.head
227 head = testrepo[head_object.target]
228 assert head.id == branch_i18n.target
229 assert 'new' in head.tree
230 assert 'bye.txt' not in testrepo.status()
231
232
233def test_checkout_index(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…