pub struct RefTransaction { /* private fields */ }Expand description
Batch of ref updates prepared for super::RefStore::prepare.
Implementations§
Source§impl RefTransaction
impl RefTransaction
Sourcepub fn update(self, update: RefUpdate) -> Result<Self, RefStoreError>
pub fn update(self, update: RefUpdate) -> Result<Self, RefStoreError>
Append an update, rejecting duplicate ref names in the same batch.
§Errors
Returns RefStoreError::DuplicateUpdate when update.name was already queued.
Sourcepub fn push_update(&mut self, update: RefUpdate) -> Result<(), RefStoreError>
pub fn push_update(&mut self, update: RefUpdate) -> Result<(), RefStoreError>
Append an update in place.
§Errors
Returns RefStoreError::DuplicateUpdate when update.name was already queued.
Sourcepub fn into_updates(self) -> Vec<RefUpdate>
pub fn into_updates(self) -> Vec<RefUpdate>
Consume the transaction and return the update list.
Sourcepub fn reflog_renames(&self) -> &[RefReflogRename]
pub fn reflog_renames(&self) -> &[RefReflogRename]
Reflog rename operations bundled with this transaction.
Sourcepub fn case_only_renames(&self) -> &[RefCaseOnlyRename]
pub fn case_only_renames(&self) -> &[RefCaseOnlyRename]
Case-only ref renames bundled with this transaction.
Sourcepub fn with_reflog_rename(self, rename: RefReflogRename) -> Self
pub fn with_reflog_rename(self, rename: RefReflogRename) -> Self
Append a branch reflog rename to this transaction.
Sourcepub fn with_case_only_rename(self, rename: RefCaseOnlyRename) -> Self
pub fn with_case_only_rename(self, rename: RefCaseOnlyRename) -> Self
Append a case-only branch ref rename (files backend).
Sourcepub fn initial(self) -> Self
pub fn initial(self) -> Self
Mark this as the first ref transaction of a new repository, such as the remote refs a clone imports (Git’s initial ref transaction).
The files backend then writes the batch as one packed-refs rewrite, without a loose
file or lock per ref, when every update creates a direct ref (no reflog, expectation
Expected::Any or Expected::Missing) that does not exist yet in the common
directory. Any other batch, and every other backend, commits as usual, so the flag
never changes which refs end up stored, only how they are laid out.
The packed write takes only packed-refs.lock: callers promise no other writer is
creating the same refs, which holds for a repository nobody else knows about yet.
Sourcepub fn is_initial(&self) -> bool
pub fn is_initial(&self) -> bool
Whether Self::initial marked this transaction.
Sourcepub fn allowing_failures(self) -> Self
pub fn allowing_failures(self) -> Self
Allow per-ref rejections during prepare while committing the rest in one batch.
Rejections are returned from super::PreparedRefTransaction::rejected_updates.
Compare-and-swap, directory/file, and object-target failures on one ref do not roll back
sibling updates in the same transaction. Duplicate names, invalid ref names, and other
whole-transaction errors still fail prepare entirely.
Sourcepub fn allows_failures(&self) -> bool
pub fn allows_failures(&self) -> bool
Whether Self::allowing_failures was set.
Sourcepub fn into_parts(
self,
) -> (Vec<RefUpdate>, Vec<RefReflogRename>, Vec<RefCaseOnlyRename>)
pub fn into_parts( self, ) -> (Vec<RefUpdate>, Vec<RefReflogRename>, Vec<RefCaseOnlyRename>)
Split into ref updates, reflog renames, and case-only ref renames.
Trait Implementations§
Source§impl Clone for RefTransaction
impl Clone for RefTransaction
Source§impl Debug for RefTransaction
impl Debug for RefTransaction
Source§impl Default for RefTransaction
impl Default for RefTransaction
impl Eq for RefTransaction
Source§impl PartialEq for RefTransaction
impl PartialEq for RefTransaction
impl StructuralPartialEq for RefTransaction
Auto Trait Implementations§
impl Freeze for RefTransaction
impl RefUnwindSafe for RefTransaction
impl Send for RefTransaction
impl Sync for RefTransaction
impl Unpin for RefTransaction
impl UnsafeUnpin for RefTransaction
impl UnwindSafe for RefTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.