Struct branchless::core::dag::Dag
source · pub struct Dag {
pub head_commit: CommitSet,
pub main_branch_commit: CommitSet,
pub branch_commits: CommitSet,
/* private fields */
}
Expand description
Interface to access the directed acyclic graph (DAG) representing Git’s commit graph. Based on the Eden SCM DAG.
Fields
head_commit: CommitSet
A set containing the commit which HEAD
points to. If HEAD
is unborn,
this is an empty set.
main_branch_commit: CommitSet
A set containing the commit that the main branch currently points to.
branch_commits: CommitSet
A set containing all commits currently pointed to by local branches.
Implementations
sourceimpl Dag
impl Dag
sourcepub fn open_and_sync(
effects: &Effects,
repo: &Repo,
event_replayer: &EventReplayer,
event_cursor: EventCursor,
references_snapshot: &RepoReferencesSnapshot
) -> Result<Self>
pub fn open_and_sync(
effects: &Effects,
repo: &Repo,
event_replayer: &EventReplayer,
event_cursor: EventCursor,
references_snapshot: &RepoReferencesSnapshot
) -> Result<Self>
Initialize the DAG for the given repository, and update it with any newly-referenced commits.
sourcepub fn open_without_syncing(
effects: &Effects,
repo: &Repo,
event_replayer: &EventReplayer,
event_cursor: EventCursor,
references_snapshot: &RepoReferencesSnapshot
) -> Result<Self>
pub fn open_without_syncing(
effects: &Effects,
repo: &Repo,
event_replayer: &EventReplayer,
event_cursor: EventCursor,
references_snapshot: &RepoReferencesSnapshot
) -> Result<Self>
Initialize a DAG for the given repository, without updating it with new commits that may have appeared.
If used improperly, commit lookups could fail at runtime. This function should only be used for opening the DAG when it’s known that no more live commits have appeared.
sourcepub fn sync_from_oids(
&mut self,
effects: &Effects,
repo: &Repo,
master_heads: CommitSet,
non_master_heads: CommitSet
) -> Result<()>
pub fn sync_from_oids(
&mut self,
effects: &Effects,
repo: &Repo,
master_heads: CommitSet,
non_master_heads: CommitSet
) -> Result<()>
Update the DAG with the given heads.
sourcepub fn set_cursor(
&self,
effects: &Effects,
repo: &Repo,
event_replayer: &EventReplayer,
event_cursor: EventCursor
) -> Result<Self>
pub fn set_cursor(
&self,
effects: &Effects,
repo: &Repo,
event_replayer: &EventReplayer,
event_cursor: EventCursor
) -> Result<Self>
Create a new version of this DAG at the point in time represented by
event_cursor
.
sourcepub fn clear_obsolete_commits(&self, repo: &Repo) -> Result<Self>
pub fn clear_obsolete_commits(&self, repo: &Repo) -> Result<Self>
Create a new Dag
with no obsolete commits.
sourcepub fn get_only_parent_oid(&self, oid: NonZeroOid) -> Result<NonZeroOid>
pub fn get_only_parent_oid(&self, oid: NonZeroOid) -> Result<NonZeroOid>
Get the parent OID for the given OID. Returns an error if the given OID does not have exactly 1 parent.
sourcepub fn get_range(
&self,
effects: &Effects,
repo: &Repo,
parent_oid: NonZeroOid,
child_oid: NonZeroOid
) -> Result<Vec<NonZeroOid>>
pub fn get_range(
&self,
effects: &Effects,
repo: &Repo,
parent_oid: NonZeroOid,
child_oid: NonZeroOid
) -> Result<Vec<NonZeroOid>>
Get the range of OIDs from parent_oid
to child_oid
. Note that there
may be more than one path; in that case, the OIDs are returned in a
topologically-sorted order.
sourcepub fn is_public_commit(&self, commit_oid: NonZeroOid) -> Result<bool>
pub fn is_public_commit(&self, commit_oid: NonZeroOid) -> Result<bool>
Determine whether or not the given commit is a public commit (i.e. is an ancestor of the main branch).
sourcepub fn query_public_commits_slow(&self) -> Result<&CommitSet>
pub fn query_public_commits_slow(&self) -> Result<&CommitSet>
Return the set of commits which are public, as per the definition in
is_public_commit
. You should try to use is_public_commit
instead, as
it will be faster to compute.
sourcepub fn query_visible_heads(&self) -> Result<&CommitSet>
pub fn query_visible_heads(&self) -> Result<&CommitSet>
Determine the set of commits which are considered to be “visible”. A commit is “visible” if it is not obsolete or has a non-obsolete descendant.
sourcepub fn query_visible_commits_slow(&self) -> Result<&CommitSet>
pub fn query_visible_commits_slow(&self) -> Result<&CommitSet>
Query the set of all visible commits, as per the definition in
query_visible_head
s. You should try to use query_visible_heads
instead if possible, since it will be faster to compute.
sourcepub fn filter_visible_commits(&self, commits: CommitSet) -> Result<CommitSet>
pub fn filter_visible_commits(&self, commits: CommitSet) -> Result<CommitSet>
Keep only commits in the given set which are visible, as per the
definition in query_visible_heads
.
sourcepub fn query_obsolete_commits(&self) -> CommitSet
pub fn query_obsolete_commits(&self) -> CommitSet
Determine the set of obsolete commits. These commits have been rewritten or explicitly hidden by the user.
sourcepub fn query_draft_commits(&self) -> Result<&CommitSet>
pub fn query_draft_commits(&self) -> Result<&CommitSet>
Determine the set of “draft” commits. The draft commits are all visible commits which aren’t public.
sourcepub fn get_connected_components(
&self,
commit_set: &CommitSet
) -> Result<Vec<CommitSet>>
pub fn get_connected_components(
&self,
commit_set: &CommitSet
) -> Result<Vec<CommitSet>>
Given a CommitSet, return a list of CommitSets, each representing a connected component of the set.
For example, if the DAG contains commits A-B-C-D-E-F and the given
CommitSet contains B, C, E
, this will return 2 CommitSet
s: 1
containing B, C
and another containing only E
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Dag
impl Send for Dag
impl Sync for Dag
impl Unpin for Dag
impl !UnwindSafe for Dag
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<D> OwoColorize for D
impl<D> OwoColorize for D
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read morefn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more