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

Function test_transaction_multiple_refs

test/test_transaction.py:70–88  ·  view source on GitHub ↗

Test updating multiple refs in a single transaction.

(testrepo: Repository)

Source from the content-addressed store, hash-verified

68
69
70def test_transaction_multiple_refs(testrepo: Repository) -> None:
71 """Test updating multiple refs in a single transaction."""
72 master_ref = testrepo.lookup_reference('refs/heads/master')
73 i18n_ref = testrepo.lookup_reference('refs/heads/i18n')
74
75 new_master = Oid(hex='5ebeeebb320790caf276b9fc8b24546d63316533')
76 new_i18n = Oid(hex='2be5719152d4f82c7302b1c0932d8e5f0a4a0e98')
77
78 with testrepo.transaction() as txn:
79 txn.lock_ref('refs/heads/master')
80 txn.lock_ref('refs/heads/i18n')
81 txn.set_target('refs/heads/master', new_master, message='Update master')
82 txn.set_target('refs/heads/i18n', new_i18n, message='Update i18n')
83
84 # Verify both updates were applied
85 master_ref = testrepo.lookup_reference('refs/heads/master')
86 i18n_ref = testrepo.lookup_reference('refs/heads/i18n')
87 assert master_ref.target == new_master
88 assert i18n_ref.target == new_i18n
89
90
91def test_transaction_symbolic_ref(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 3

transactionMethod · 0.80
lock_refMethod · 0.80
set_targetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…