Struct git_topic_stage::Stager

source ·
pub struct Stager { /* private fields */ }
Expand description

A manager for an integration branch.

This stores the state of a staging branch and the representative topics.

Implementations§

source§

impl Stager

source

pub fn new(ctx: &GitContext, base: CommitId) -> Self

Create a new stage from the given commit.

source

pub fn from_branch( ctx: &GitContext, base: CommitId, stage: CommitId ) -> Result<Self, StagerError>

Create a new stage, discovering topics which have been merged into an integration branch.

This constructor takes a base branch and the name of the stage branch. It queries the given Git context for the history of the stage branch from the base and constructs its state from its first parent history.

If the stage does not exist, it is created with the base commit as its start.

Fails if the stage branch history does not appear to be a proper stage branch. A proper stage branch’s first parent history from the base consists only of merge commits with exactly two parents with required information in its commit message.

source

pub fn git_context(&self) -> &GitContext

Returns the git context the stager uses for operations.

source

pub fn base(&self) -> &CommitId

Returns the base branch for the integration branch.

source

pub fn topics(&self) -> &[StagedTopic]

The topics which have been merged into the stage.

source

pub fn find_topic_by_id(&self, id: u64) -> Option<&StagedTopic>

The a topic on the stage by its ID.

source

pub fn find_topic(&self, topic: &Topic) -> Option<&StagedTopic>

Find where a topic has been merged into the integration branch.

source

pub fn head(&self) -> &CommitId

Returns the newest commit in the integration branch.

source

pub fn unstage( &mut self, topic: StagedTopic ) -> Result<StageResult, StagerError>

Remove a topic from the stage.

source

pub fn stage( &mut self, topic: CandidateTopic ) -> Result<StageResult, StagerError>

Add a topic branch to the stage.

If the branch already existed on the staging branch, it is first removed from the stage and then any topics which were merged after it are merged again, in order. The updated topic is then merged as the last operation.

source

pub fn clear(&mut self) -> Vec<StagedTopic>

Remove all staged topics from the staging branch.

Previously staged topics are returned.

Trait Implementations§

source§

impl Debug for Stager

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.