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§
Source§impl 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 sort(&self, commit_set: &CommitSet) -> Result<Vec<NonZeroOid>>
pub fn sort(&self, commit_set: &CommitSet) -> Result<Vec<NonZeroOid>>
Wrapper around DAG method.
Sourcepub fn commit_set_to_vec(
&self,
commit_set: &CommitSet,
) -> Result<Vec<NonZeroOid>>
pub fn commit_set_to_vec( &self, commit_set: &CommitSet, ) -> Result<Vec<NonZeroOid>>
Eagerly convert a CommitSet
into a Vec<NonZeroOid>
by iterating over it, preserving order.
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 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_is_ancestor(
&self,
ancestor: NonZeroOid,
descendant: NonZeroOid,
) -> Result<bool>
pub fn query_is_ancestor( &self, ancestor: NonZeroOid, descendant: NonZeroOid, ) -> Result<bool>
Wrapper around DAG method.
Sourcepub fn set_is_empty(&self, commit_set: &CommitSet) -> Result<bool>
pub fn set_is_empty(&self, commit_set: &CommitSet) -> Result<bool>
Wrapper around NameSet method.
Sourcepub fn set_contains<T: Into<CommitVertex> + Debug>(
&self,
commit_set: &CommitSet,
oid: T,
) -> Result<bool>
pub fn set_contains<T: Into<CommitVertex> + Debug>( &self, commit_set: &CommitSet, oid: T, ) -> Result<bool>
Wrapper around NameSet method.
Sourcepub fn set_count(&self, commit_set: &CommitSet) -> Result<usize>
pub fn set_count(&self, commit_set: &CommitSet) -> Result<usize>
Wrapper around NameSet method.
Sourcepub fn set_first(&self, commit_set: &CommitSet) -> Result<Option<CommitVertex>>
pub fn set_first(&self, commit_set: &CommitSet) -> Result<Option<CommitVertex>>
Wrapper around NameSet method.
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 query_stack_commits(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_stack_commits(&self, commit_set: CommitSet) -> Result<CommitSet>
Determine the connected components among draft commits (commit “stacks”) that intersect with the provided set.
Sourcepub fn query_parents(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_parents(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_parent_names<T: Into<CommitVertex> + Debug>(
&self,
vertex: T,
) -> Result<Vec<CommitVertex>>
pub fn query_parent_names<T: Into<CommitVertex> + Debug>( &self, vertex: T, ) -> Result<Vec<CommitVertex>>
Wrapper around DAG method.
Sourcepub fn query_ancestors(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_ancestors(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_first_ancestor_nth(
&self,
vertex: CommitVertex,
n: u64,
) -> Result<Option<CommitVertex>>
pub fn query_first_ancestor_nth( &self, vertex: CommitVertex, n: u64, ) -> Result<Option<CommitVertex>>
Wrapper around DAG method.
Sourcepub fn query_children(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_children(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_descendants(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_descendants(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_roots(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_roots(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_heads(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_heads(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_heads_ancestors(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_heads_ancestors(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_only(
&self,
reachable: CommitSet,
unreachable: CommitSet,
) -> Result<CommitSet>
pub fn query_only( &self, reachable: CommitSet, unreachable: CommitSet, ) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_range(
&self,
roots: CommitSet,
heads: CommitSet,
) -> Result<CommitSet>
pub fn query_range( &self, roots: CommitSet, heads: CommitSet, ) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_common_ancestors(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_common_ancestors(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
Sourcepub fn query_gca_one(
&self,
commit_set: CommitSet,
) -> Result<Option<CommitVertex>>
pub fn query_gca_one( &self, commit_set: CommitSet, ) -> Result<Option<CommitVertex>>
Wrapper around DAG method.
Sourcepub fn query_gca_all(&self, commit_set: CommitSet) -> Result<CommitSet>
pub fn query_gca_all(&self, commit_set: CommitSet) -> Result<CommitSet>
Wrapper around DAG method.
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 !Freeze for Dag
impl !RefUnwindSafe for Dag
impl Send for Dag
impl Sync for Dag
impl Unpin for Dag
impl !UnwindSafe for Dag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§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 moreSource§fn 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