gix_merge::blob

Struct Platform

Source
pub struct Platform {
    pub filter: Pipeline,
    pub attr_stack: Stack,
    pub options: Options,
    pub filter_mode: Mode,
    /* private fields */
}
Expand description

A utility for gathering and processing all state necessary to perform a three-way merge.

It can re-use buffers if all three parts of participating in the merge are set repeatedly.

Fields§

§filter: Pipeline

A way to convert objects into a diff-able format.

§attr_stack: Stack

A way to access .gitattributes

§options: Options

Further configuration that affects the merge.

§filter_mode: Mode

The way we convert resources into mergeable states.

Implementations§

Source§

impl Platform

Preparation

Source

pub fn set_resource( &mut self, id: ObjectId, mode: EntryKind, rela_path: &BStr, kind: ResourceKind, objects: &impl FindObjectOrHeader, ) -> Result<(), Error>

Store enough information about a resource to eventually use it in a merge, where…

  • id is the hash of the resource. If it is null, it should either be a resource in the worktree, or it’s considered a non-existing, deleted object. If an id is known, as the hash of the object as (would) be stored in git, then it should be provided for completeness. Note that it’s not expected to be in objects if rela_path is set and a worktree-root is available for kind.
  • mode is the kind of object (only blobs and executables are allowed)
  • rela_path is the relative path as seen from the (work)tree root.
  • kind identifies the side of the merge this resource will be used for.
  • objects provides access to the object database in case the resource can’t be read from a worktree.
Source§

impl Platform

Preparation

Source

pub fn prepare_merge( &mut self, objects: &impl Find, options: Options, ) -> Result<PlatformRef<'_>, Error>

Prepare all state needed for performing a merge, using all previously set resources. objects is used to possibly lookup attribute files when obtaining merge-related attributes.

options are to be used when merging later, and they may be altered to implement correct binary merges in the present of virtual merge bases.

Note that no additional validation is performed here to facilitate inspection, which means that resource buffers might still be too large to be merged, preventing a successful merge at a later time.

Source§

impl Platform

Lifecycle

Source

pub fn new( filter: Pipeline, filter_mode: Mode, attr_stack: Stack, drivers: Vec<Driver>, options: Options, ) -> Self

Create a new instance with a way to filter data from the object database and turn it into something that is merge-able. filter_mode decides how to do that specifically. Use attr_stack to access attributes pertaining worktree filters and merge settings. drivers are the list of available merge drivers that individual paths can refer to by means of git attributes. options further configure the operation.

Source§

impl Platform

Access

Source

pub fn drivers(&self) -> &[Driver]

Return all drivers that this instance was initialized with.

They are sorted by name to support binary searches.

Trait Implementations§

Source§

impl Clone for Platform

Source§

fn clone(&self) -> Platform

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

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.