pub enum Event<'a, 'old, 'new> {
Addition {
entry_mode: EntryMode,
id: Id<'new>,
},
Deletion {
entry_mode: EntryMode,
id: Id<'old>,
},
Modification {
previous_entry_mode: EntryMode,
previous_id: Id<'old>,
entry_mode: EntryMode,
id: Id<'new>,
},
Rename {
source_location: &'a BStr,
source_entry_mode: EntryMode,
source_id: Id<'old>,
entry_mode: EntryMode,
id: Id<'new>,
},
Copy {
source_location: &'a BStr,
source_entry_mode: EntryMode,
source_id: Id<'old>,
entry_mode: EntryMode,
id: Id<'new>,
},
}
Expand description
An event emitted when finding differences between two trees.
Variants§
Addition
Fields
An entry was added, like the addition of a file or directory.
Deletion
Fields
An entry was deleted, like the deletion of a file or directory.
Modification
Fields
An entry was modified, e.g. changing the contents of a file adjusts its object id and turning a file into a symbolic link adjusts its mode.
Rename
Fields
source_location: &'a BStr
The location of the source of the rename operation.
It may be empty if neither file names nor file paths are tracked.
source_id: Id<'old>
The object id of the entry before the rename.
Note that this is the same as id
if we require the similarity to be 100%, but may
be different otherwise.
Entries are considered renamed if they are not trees and they, according to some understanding of identity, appeared
as Deletion
in case of the previous source of the rename as well as Addition
acting as destination all the while rename tracking is enabled.
Note that mode changes may have occurred as well, i.e. changes from executable to non-executable or vice-versa.
Copy
Fields
source_location: &'a BStr
The location of the source of the copy operation.
It may be empty if neither file names nor file paths are tracked.
source_id: Id<'old>
The object id of the source of the copy.
Note that this is the same as id
if we require the similarity to be 100%, but may
be different otherwise.
This entry is considered to be a copy of another, according to some understanding of identity, as its source still exists. If the source wouldn’t exist, it would be considered a rename.
This variant may only occur if rename tracking is enabled, otherwise copies appear to be plain additions.
Implementations§
source§impl<'a, 'old, 'new> Event<'a, 'old, 'new>
impl<'a, 'old, 'new> Event<'a, 'old, 'new>
sourcepub fn diff(&self) -> Option<Result<Platform<'old, 'new>, Error>>
pub fn diff(&self) -> Option<Result<Platform<'old, 'new>, Error>>
Produce a platform for performing a line-diff, or None
if this is not a Modification
or one of the entries to compare is not a blob.
sourcepub fn entry_mode(&self) -> EntryMode
pub fn entry_mode(&self) -> EntryMode
Return the current mode of this instance.