pub trait Navigate {
// Required methods
fn traverse(&mut self, kind: Traversal) -> Option<()>;
fn peel_until(&mut self, kind: PeelTo<'_>) -> Option<()>;
fn find(&mut self, regex: &BStr, negated: bool) -> Option<()>;
fn index_lookup(&mut self, path: &BStr, stage: u8) -> Option<()>;
}
Expand description
Once an anchor is set one can adjust it using traversal methods.
Required Methods§
Sourcefn traverse(&mut self, kind: Traversal) -> Option<()>
fn traverse(&mut self, kind: Traversal) -> Option<()>
Adjust the current revision to traverse the graph according to kind
.
Sourcefn peel_until(&mut self, kind: PeelTo<'_>) -> Option<()>
fn peel_until(&mut self, kind: PeelTo<'_>) -> Option<()>
Peel the current object until it reached kind
or None
if the chain does not contain such object.
Sourcefn find(&mut self, regex: &BStr, negated: bool) -> Option<()>
fn find(&mut self, regex: &BStr, negated: bool) -> Option<()>
Find the first revision/commit whose message matches the given regex
(which is never empty).
to see how it should be matched.
If negated
is true
, the first non-match will be a match.
If no revision is known yet, find the youngest matching commit from any reference, including HEAD
.
Otherwise, only find commits reachable from the currently set revision.
Sourcefn index_lookup(&mut self, path: &BStr, stage: u8) -> Option<()>
fn index_lookup(&mut self, path: &BStr, stage: u8) -> Option<()>
Look up the given path
at the given stage
in the index returning its blob id,
or return None
if it doesn’t exist at this stage
.
Note that this implies no revision is needed and no anchor is set yet.
stage
ranges from 0 to 2, with 0 being the base, 1 being ours, 2 being theirs.path
without prefix is relative to the root of the repository, while prefixes like./
and../
make it relative to the current working directory.