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)
| 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 |