pub enum ChangeRef<'a> {
Addition {
location: &'a BStr,
entry_mode: EntryMode,
relation: Option<Relation>,
id: ObjectId,
},
Deletion {
location: &'a BStr,
entry_mode: EntryMode,
relation: Option<Relation>,
id: ObjectId,
},
Modification {
location: &'a BStr,
previous_entry_mode: EntryMode,
previous_id: ObjectId,
entry_mode: EntryMode,
id: ObjectId,
},
Rewrite {
source_location: &'a BStr,
source_entry_mode: EntryMode,
source_relation: Option<Relation>,
source_id: ObjectId,
diff: Option<DiffLineStats>,
entry_mode: EntryMode,
id: ObjectId,
location: &'a BStr,
relation: Option<Relation>,
copy: bool,
},
}
blob
only.Expand description
Represents any possible change in order to turn one tree into another, which references data owned by its producer.
Variants§
Addition
An entry was added, like the addition of a file or directory.
Fields
location: &'a BStr
The location of the file or directory.
It may be empty if file names is None
.
Deletion
An entry was deleted, like the deletion of a file or directory.
Fields
location: &'a BStr
The location of the file or directory.
It may be empty if file names is None
.
are tracked.
Modification
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.
Fields
location: &'a BStr
The location of the file or directory.
It may be empty if file names is None
.
are tracked.
Rewrite
Entries are considered rewritten if they are not trees and they, according to some understanding of identity, were renamed
or copied.
In case of renames, this means they originally appeared as Deletion
signalling their source as well as an
Addition
acting as destination.
In case of copies, the copy
flag is true and typically represents a perfect copy of a source was made.
This variant can only be encountered if rewrite tracking is enabled.
Note that mode changes may have occurred as well, i.e. changes from executable to non-executable or vice-versa.
Fields
source_location: &'a BStr
The location of the source of the rename or copy operation.
It may be empty if file names is None
.
are tracked.
source_relation: Option<Relation>
Identifies a relationship between the source and another source, making it easy to reconstruct the top-level of directory changes.
source_id: ObjectId
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.
diff: Option<DiffLineStats>
Information about the diff we performed to detect similarity and match the source_id
with the current state at id
.
It’s None
if source_id
is equal to id
, as identity made an actual diff computation unnecessary.
entry_mode: EntryMode
The mode of the entry after the rename. It could differ but still be considered a rename as we are concerned only about content.
location: &'a BStr
The location after the rename or copy operation.
It may be empty if file names is None
.
Implementations§
Source§impl ChangeRef<'_>
impl ChangeRef<'_>
Lifecycle
Sourcepub fn into_owned(self) -> Change
pub fn into_owned(self) -> Change
Copy this instance into a fully-owned version
Source§impl<'a> ChangeRef<'a>
impl<'a> ChangeRef<'a>
Sourcepub fn relation(&self) -> Option<Relation>
pub fn relation(&self) -> Option<Relation>
Return the relation this instance may have to other changes.
Sourcepub fn entry_mode(&self) -> EntryMode
pub fn entry_mode(&self) -> EntryMode
Return the current mode of this instance.
Sourcepub fn entry_mode_and_id(&self) -> (EntryMode, &oid)
pub fn entry_mode_and_id(&self) -> (EntryMode, &oid)
Return the current mode of this instance, along with its object id.
Sourcepub fn source_entry_mode_and_id(&self) -> (EntryMode, &oid)
pub fn source_entry_mode_and_id(&self) -> (EntryMode, &oid)
Return the previous mode and id of the resource where possible, i.e. the source of a rename or copy, or a modification.
Sourcepub fn location(&self) -> &'a BStr
pub fn location(&self) -> &'a BStr
Return the current location of the resource, i.e. the destination of a rename or copy, or the location at which an addition, deletion or modification took place.
Sourcepub fn source_location(&self) -> &BStr
pub fn source_location(&self) -> &BStr
Return the previous location of the resource where possible, i.e. the source of a rename or copy, or the location at which an addition, deletion or modification took place.