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

Function test_transaction_symbolic_ref

test/test_transaction.py:91–103  ·  view source on GitHub ↗

Test updating symbolic reference in transaction.

(testrepo: Repository)

Source from the content-addressed store, hash-verified

89
90
91def test_transaction_symbolic_ref(testrepo: Repository) -> None:
92 """Test updating symbolic reference in transaction."""
93 with testrepo.transaction() as txn:
94 txn.lock_ref('HEAD')
95 txn.set_symbolic_target('HEAD', 'refs/heads/i18n', message='Switch HEAD')
96
97 head = testrepo.lookup_reference('HEAD')
98 assert head.target == 'refs/heads/i18n'
99
100 # Restore HEAD to master
101 with testrepo.transaction() as txn:
102 txn.lock_ref('HEAD')
103 txn.set_symbolic_target('HEAD', 'refs/heads/master', message='Restore HEAD')
104
105
106def test_transaction_remove_ref(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 3

transactionMethod · 0.80
lock_refMethod · 0.80
set_symbolic_targetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…