pub struct Platform<'a, 'repo> { /* private fields */ }
blob-diff
only.Expand description
The diffing platform returned by Tree::changes()
.
Implementations§
source§impl<'a, 'old> Platform<'a, 'old>
impl<'a, 'old> Platform<'a, 'old>
Add the item to compare to.
sourcepub fn for_each_to_obtain_tree<'new, E>(
&mut self,
other: &Tree<'new>,
for_each: impl FnMut(Change<'_, 'old, 'new>) -> Result<Action, E>
) -> Result<Outcome, Error>where
E: Error + Sync + Send + 'static,
pub fn for_each_to_obtain_tree<'new, E>( &mut self, other: &Tree<'new>, for_each: impl FnMut(Change<'_, 'old, 'new>) -> Result<Action, E> ) -> Result<Outcome, Error>where E: Error + Sync + Send + 'static,
Call for_each
repeatedly with all changes that are needed to convert the source of the diff to the tree to other
.
other
could also be created with the empty_tree()
method to handle the first commit
in a repository - it doesn’t have a parent, equivalent to compare ‘nothing’ to something.
source§impl<'a, 'repo> Platform<'a, 'repo>
impl<'a, 'repo> Platform<'a, 'repo>
Configuration
sourcepub fn track_filename(&mut self) -> &mut Self
pub fn track_filename(&mut self) -> &mut Self
Keep track of file-names, which makes the location
field usable with the filename of the changed item.
sourcepub fn track_path(&mut self) -> &mut Self
pub fn track_path(&mut self) -> &mut Self
Keep track of the entire path of a change, relative to the repository.
This makes the location
field usable.
sourcepub fn track_rewrites(&mut self, renames: Option<Rewrites>) -> &mut Self
pub fn track_rewrites(&mut self, renames: Option<Rewrites>) -> &mut Self
Provide None
to disable rewrite tracking entirely, or pass Some(<configuration>)
to control to
what extend rename and copy tracking is performed.
Note that by default, the git configuration determines rewrite tracking and git defaults are used if nothing is configured, which turns rename tracking with 50% similarity on, while not tracking copies at all.