pub struct Dag {
pub head_commit: CommitSet,
pub main_branch_commit: CommitSet,
pub branch_commits: CommitSet,
pub observed_commits: CommitSet,
pub obsolete_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.
observed_commits: CommitSet
A set containing all commits that have been observed by the
EventReplayer
.
obsolete_commits: CommitSet
A set containing all commits that have been determined to be obsolete by
the EventReplayer
.
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 get_one_merge_base_oid(
&self,
effects: &Effects,
repo: &Repo,
lhs_oid: NonZeroOid,
rhs_oid: NonZeroOid
) -> Result<Option<NonZeroOid>>
pub fn get_one_merge_base_oid(
&self,
effects: &Effects,
repo: &Repo,
lhs_oid: NonZeroOid,
rhs_oid: NonZeroOid
) -> Result<Option<NonZeroOid>>
Get one of the merge-base OIDs for the given pair of OIDs. If there are multiple possible merge-bases, one is arbitrarily returned.
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 query_public_commits(&self) -> Result<CommitSet>
pub fn query_public_commits(&self) -> Result<CommitSet>
Return the set of commits which are public (checked into the main branch).
sourcepub fn query_active_heads(
&self,
public_commits: &CommitSet,
observed_commits: &CommitSet
) -> Result<CommitSet>
pub fn query_active_heads(
&self,
public_commits: &CommitSet,
observed_commits: &CommitSet
) -> Result<CommitSet>
Query the set of active heads. This includes the heads of the set of visible commits, plus any other commits which would be rendered in the smartlog.
This query includes heads which may be ancestor of other commits in the
set. For example, if HEAD
points to a commit which is the ancestor of
a visible commit, both commits are included in the resulting set. This
is so that they can be explicitly rendered in the smartlog. To get the
set of visible commits, simply query for the ancestors of the set
resulting from this function.
sourcepub fn find_path_to_main_branch(
&self,
effects: &Effects,
head: CommitSet
) -> Result<Option<CommitSet>>
pub fn find_path_to_main_branch(
&self,
effects: &Effects,
head: CommitSet
) -> Result<Option<CommitSet>>
Find a path from the provided head to its merge-base with the main branch.
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 self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'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