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

Method transaction

pygit2/repository.py:391–405  ·  view source on GitHub ↗

Create a new reference transaction. Returns a context manager that commits all reference updates atomically when the context exits successfully, or performs no updates if an exception is raised. Example:: with repo.transaction() as txn:

(self)

Source from the content-addressed store, hash-verified

389 return (commit, reference) # type: ignore
390
391 def transaction(self) -> ReferenceTransaction:
392 """Create a new reference transaction.
393
394 Returns a context manager that commits all reference updates atomically
395 when the context exits successfully, or performs no updates if an exception
396 is raised.
397
398 Example::
399
400 with repo.transaction() as txn:
401 txn.lock_ref('refs/heads/master')
402 txn.set_target('refs/heads/master', new_oid, message='Update')
403 """
404 txn = ReferenceTransaction(self)
405 return txn
406
407 #
408 # Checkout

Callers 13

update_ref1Function · 0.80
update_ref2Function · 0.80
thread1_taskFunction · 0.80
thread2_taskFunction · 0.80
create_transactionFunction · 0.80

Calls 1

Tested by 13

update_ref1Function · 0.64
update_ref2Function · 0.64
thread1_taskFunction · 0.64
thread2_taskFunction · 0.64
create_transactionFunction · 0.64