Skip to main content

GitSpeculator

Struct GitSpeculator 

Source
pub struct GitSpeculator { /* private fields */ }
Expand description

A speculator over a real repository: states are commit ids.

Implementations§

Source§

impl GitSpeculator

Source

pub fn new(repo: PathBuf) -> Self

A speculator over repo, a non-bare clone whose worktree it owns.

Source

pub fn verify(&self, state: &str) -> Result<String, String>

Whether state names a commit this repository holds.

The queue’s base comes from its caller, and a base that is not a commit would otherwise be discovered as a merge failure against the first change submitted — reported as that author’s problem.

§Errors

The oid is unknown, unparseable, or not a commit.

Trait Implementations§

Source§

impl Speculator for GitSpeculator

Source§

fn step(&mut self, _base: &str, onto: &str, proposed: &str) -> Step

base is ignored: git finds the merge base itself, and the one it finds is better than the one the caller declared. The argument exists for the text implementation, which has no way to find it.

Source§

fn identity(&self, change: &Change) -> String

The patch identity of base..proposed, which is what survives a rebase: the train rewriting the tip under an author gives the same edit a new commit id and the same identity here.

An unreadable pair yields a unique identity rather than a shared one. Two changes we could not read are not thereby the same change, and collapsing them would make the queue refuse the second as already landed.

Source§

fn subject(&self, state: &str) -> ContentHash

The commit id, as a git-codec ContentHash.

§Panics

If state is not a git object id. Every state after the first is one this type produced with rev-parse; the first is the caller’s base, which GitSpeculator::verify exists to check before a queue is built on it.

Source§

fn name(&self) -> &'static str

Stable identifier, for reports and errors.

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.