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 links 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 T)

🔬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.