Struct branchless::git::Dag [−][src]
pub struct Dag {
pub head_commit: CommitSet,
pub main_branch_commit: CommitSet,
pub branch_commits: CommitSet,
pub observed_commits: CommitSet,
pub obsolete_commits: CommitSet,
// some fields omitted
}
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
pub 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.
pub 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.
Update the DAG with the given heads.
pub 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
.
pub 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.
pub 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.
Return the set of commits which are public (checked into the main branch).
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.
pub fn find_path_to_merge_base<'repo>(
&self,
effects: &Effects,
repo: &'repo Repo,
commit_oid: NonZeroOid,
target_oid: NonZeroOid
) -> Result<Option<Vec<Commit<'repo>>>>
pub fn find_path_to_merge_base<'repo>(
&self,
effects: &Effects,
repo: &'repo Repo,
commit_oid: NonZeroOid,
target_oid: NonZeroOid
) -> Result<Option<Vec<Commit<'repo>>>>
Find a shortest path between the given commits.
This is particularly important for multi-parent commits (i.e. merge commits). If we don’t happen to traverse the correct parent, we may end up traversing a huge amount of commit history, with a significant performance hit.
Args:
repo
: The Git repository.commit_oid
: The OID of the commit to start at. We take parents of the provided commit until we end up at the target OID.target_oid
: The OID of the commit to end at.
Returns: A path of commits from commit_oid
through parents to target_oid
.
The path includes commit_oid
at the beginning and target_oid
at the end.
If there is no such path, returns None
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Dag
impl !UnwindSafe for Dag
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn fg<C>(&'a self) -> FgColorDisplay<'a, C, Self> where
C: Color,
fn fg<C>(&'a self) -> FgColorDisplay<'a, C, Self> where
C: Color,
Set the foreground color generically Read more
fn bg<C>(&'a self) -> BgColorDisplay<'a, C, Self> where
C: Color,
fn bg<C>(&'a self) -> BgColorDisplay<'a, C, Self> where
C: Color,
Set the background color generically. Read more
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
Change the foreground color to black
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
Change the foreground color to black
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
Change the foreground color to red
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
Change the foreground color to red
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
Change the foreground color to green
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
Change the foreground color to green
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Change the foreground color to yellow
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Change the foreground color to yellow
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
Change the foreground color to blue
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
Change the foreground color to blue
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to purple
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the foreground color to purple
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Change the foreground color to cyan
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Change the foreground color to cyan
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
Change the foreground color to white
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
Change the foreground color to white
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
Make the text bold
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
Make the text dim
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
Make the text italicized
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
Make the text italicized
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
Make the text blink
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
Make the text blink (but fast!)
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
Swap the foreground and background colors
Hide the text
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
Cross out the text
fn color<Color>(&'a self, color: Color) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
fn color<Color>(&'a self, color: Color) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more
fn on_color<Color>(&'a self, color: Color) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
fn on_color<Color>(&'a self, color: Color) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more
Sets the foreground color to an RGB value.
fn on_truecolor(
&'a self,
r: u8,
g: u8,
b: u8
) -> BgDynColorDisplay<'a, Rgb, Self>
fn on_truecolor(
&'a self,
r: u8,
g: u8,
b: u8
) -> BgDynColorDisplay<'a, Rgb, Self>
Sets the background color to an RGB value.
pub fn vzip(self) -> V
Calls the given closure and return the result. Read more
Calls the given closure on self
.