gix_merge::tree

Struct Conflict

Source
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] => Base
  • entries[1] => Ours
  • entries[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

Source

pub fn is_unresolved(&self, how: TreatAsUnresolved) -> bool

Return true if this instance is considered unresolved based on the criterion specified by how.

Source

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.

Source

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.

Source

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().

Source

pub fn content_merge(&self) -> Option<ContentMerge>

Return information about the content merge if it was performed.

Trait Implementations§

Source§

impl Clone for Conflict

Source§

fn clone(&self) -> Conflict

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Conflict

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.