pub struct Conflict {
pub resolution: Result<Resolution, ResolutionFailure>,
pub ours: Change,
pub theirs: Change,
pub entries: [Option<ConflictIndexEntry>; 3],
/* private fields */
}
Expand description
A description of a conflict (i.e. merge issue without an auto-resolution) as seen during a tree-merge. They may have a resolution that was applied automatically, or be left for the caller to resolved.
Fields§
§resolution: Result<Resolution, ResolutionFailure>
A record on how the conflict resolution succeeded with Ok(_)
or failed with Err(_)
.
Note that in case of Err(_)
, edits may still have been made to the tree to aid resolution.
On failure, one can examine ours
and theirs
to potentially find a custom solution.
Note that the descriptions of resolutions or resolution failures may be swapped compared
to the actual changes. This is due to changes like modification|deletion
being treated the
same as deletion|modification
, i.e. ours is not more privileged than theirs.
To compensate for that, use changes_in_resolution()
.
ours: Change
The change representing our side.
theirs: Change
The change representing their side.
entries: [Option<ConflictIndexEntry>; 3]
An array to store an entry for each stage of the conflict.
entries[0]
=> Baseentries[1]
=> Oursentries[2]
=> Theirs
Note that ours and theirs might be swapped, so one should access it through Self::entries()
to compensate for that.
Implementations§
Source§impl Conflict
impl Conflict
Sourcepub fn is_unresolved(&self, how: TreatAsUnresolved) -> bool
pub fn is_unresolved(&self, how: TreatAsUnresolved) -> bool
Return true
if this instance is considered unresolved based on the criterion specified by how
.
Sourcepub fn changes_in_resolution(&self) -> (&Change, &Change)
pub fn changes_in_resolution(&self) -> (&Change, &Change)
Returns the changes of fields ours
and theirs
so they match their description in the
Resolution
or ResolutionFailure
respectively.
Without this, the sides may appear swapped as ours|theirs
is treated the same as theirs/ours
if both types are different, like modification|deletion
.
Sourcepub fn into_parts_by_resolution(
self,
) -> (Result<Resolution, ResolutionFailure>, Change, Change)
pub fn into_parts_by_resolution( self, ) -> (Result<Resolution, ResolutionFailure>, Change, Change)
Similar to changes_in_resolution()
, but returns the parts
of the structure so the caller can take ownership. This can be useful when applying your own
resolutions for resolution failures.
Sourcepub fn entries(&self) -> [Option<ConflictIndexEntry>; 3]
pub fn entries(&self) -> [Option<ConflictIndexEntry>; 3]
Return the index entries for insertion into the index, to match with what’s returned by Self::changes_in_resolution()
.
Sourcepub fn content_merge(&self) -> Option<ContentMerge>
pub fn content_merge(&self) -> Option<ContentMerge>
Return information about the content merge if it was performed.