Skip to main content

Operations

Struct Operations 

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

Paused merge, rebase, pick, revert and bisect state for one open repository.

Get one with Repository::operation.

§Examples

use grit_lib::repo::{InitOptions, Repository};
let dir = tempfile::tempdir()?;
let (repo, _) = Repository::init(dir.path(), &InitOptions::default())?;
let state = repo.operation().state()?;
assert!(state.is_clean());
assert!(repo.operation().blocking_switch()?.is_none());

Implementations§

Source§

impl<'repo> Operations<'repo>

Source

pub fn repository(&self) -> &'repo Repository

Underlying repository.

Source

pub fn state(&self) -> Result<OperationState>

Paused operations and the state files they keep.

§Errors

Error::Io when a state file exists but cannot be read, an object id error for a malformed MERGE_HEAD, and ref store failures reading ORIG_HEAD.

Source

pub fn in_progress(&self) -> Vec<InProgressOperation>

Just the paused operations, the cheap part of Self::state.

Source

pub fn blocking_switch(&self) -> Result<Option<InProgressOperation>>

The paused operation that must finish (or be aborted) before HEAD may move to another branch or commit, if any.

Merge, rebase, am, cherry-pick and revert all keep state tied to the current HEAD; a bisect does not block.

§Errors

Error::Io when a state file cannot be read.

Source

pub fn status_state(&self) -> Result<WtStatusState>

Everything status reports about paused operations: which operation, the branch and onto commit of a rebase, the picked or reverted commit, and the bisect start.

WtStatusState::detached_from is left unset; the status model (StatusModel::state) fills it in.

§Errors

Error::Io when a state file cannot be read.

Source

pub fn clear(&self) -> Result<Vec<InProgressOperation>>

Remove the state files of every paused operation without moving HEAD, refs, the index or the work tree, and return the operations that were paused.

This forgets an operation rather than aborting it: nothing is restored.

§Errors

Error::Io when a state file cannot be removed.

Source

pub fn split_commit_in_progress(&self) -> Result<bool>

Whether an interactive rebase stopped to split a commit and the split is not done yet (HEAD has moved off the commit being edited).

§Errors

Ref store failures resolving HEAD.

Trait Implementations§

Source§

impl<'repo> Clone for Operations<'repo>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'repo> Copy for Operations<'repo>

Source§

impl<'repo> Debug for Operations<'repo>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'repo> !RefUnwindSafe for Operations<'repo>

§

impl<'repo> !UnwindSafe for Operations<'repo>

§

impl<'repo> Forget for Operations<'repo>

§

impl<'repo> Freeze for Operations<'repo>

§

impl<'repo> Send for Operations<'repo>

§

impl<'repo> Sync for Operations<'repo>

§

impl<'repo> Unpin for Operations<'repo>

§

impl<'repo> UnsafeUnpin for Operations<'repo>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.