pub struct Transaction<'repo> { /* private fields */ }
Expand description

A structure representing a transactional update of a repository’s references.

Transactions work by locking loose refs for as long as the Transaction is held, and committing all changes to disk when Transaction::commit is called. Note that comitting is not atomic: if an operation fails, the transaction aborts, but previous successful operations are not rolled back.

Implementations

Lock the specified reference by name.

Set the target of the specified reference.

The reference must have been locked via lock_ref.

If reflog_signature is None, the Signature is read from the repository config.

Set the target of the specified symbolic reference.

The reference must have been locked via lock_ref.

If reflog_signature is None, the Signature is read from the repository config.

Add a Reflog to the transaction.

This commit the in-memory Reflog to disk when the transaction commits. Note that atomicty is *not guaranteed: if the transaction fails to modify refname, the reflog may still have been comitted to disk.

If this is combined with setting the target, that update won’t be written to the log (ie. the reflog_signature and reflog_message parameters will be ignored).

Remove a reference.

The reference must have been locked via lock_ref.

Commit the changes from the transaction.

The updates will be made one by one, and the first failure will stop the processing.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.