Skip to main content

MergeBase

Struct MergeBase 

Source
pub struct MergeBase { /* private fields */ }
Expand description

The tree at the merge-base of HEAD and the pull request’s base, and the paths the working tree changes against it. The content check for a Version PR replays the version step on this tree.

Implementations§

Source§

impl MergeBase

Source

pub fn read(root: &Path, candidates: &[String]) -> Result<Option<Self>>

Read the merge-base tree and list each tracked path that differs from it: committed on the branch, modified, or deleted. A symlink or a submodule differs when its entry on HEAD does. Untracked files are left out.

None when there is no repository, or no origin and none of the candidate refs, as for files_on_merge_base.

§Errors

Returns an error under the conditions of files_on_merge_base, or when a tree, a blob, a working tree file, or git status cannot be read.

Source

pub fn workdir(&self) -> &Path

The working tree’s root, canonical.

Source

pub fn changed(&self) -> &BTreeSet<String>

Each path, relative to the working tree’s root, that differs from the merge-base. A file differs by its bytes, a symlink by its target, and a submodule by its commit.

Source

pub fn base_bytes(&self, rel: &str) -> Result<Option<Vec<u8>>>

A file’s bytes at the merge-base, or None when it has no file there.

§Errors

Returns an error when the blob cannot be read.

Source

pub fn worktree_bytes(&self, rel: &str) -> Result<Option<Vec<u8>>>

A file’s bytes in the working tree, or None when it is missing.

§Errors

Returns an error when the file exists but cannot be read.

Source

pub fn write_to(&self, dir: &Path) -> Result<()>

Write every regular file of the merge-base tree under dir. Each file keeps its executable bit.

The whole tree is written because the replay’s readers are not a fixed list. cargo metadata expands member globs and needs each member’s target files. A pin or a served file can name any path. Symlinks are not recreated, so no write through one leaves dir.

§Errors

Returns an error when a blob cannot be read or a file cannot be written.

Trait Implementations§

Source§

impl Debug for MergeBase

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for MergeBase

§

impl !RefUnwindSafe for MergeBase

§

impl !Send for MergeBase

§

impl !Sync for MergeBase

§

impl !UnwindSafe for MergeBase

§

impl Forget for MergeBase

§

impl Move for MergeBase

§

impl Unpin for MergeBase
where *const u8 is !null: Unpin, Rc<SharedFileSnapshotMut<Buffer>>: Unpin, Rc<Store>: Unpin, Arc<File>: Unpin, Arc<File>: Unpin, Arc<File>: Unpin, Arc<Vec<Store>>: Unpin, *mut u8: Unpin, *mut i8: Unpin, &'static mut State<'static>: Unpin, *mut c_void: Unpin, &'static (): Unpin, Arc<dyn Fn() -> Box<dyn DecodeEntry + Send> + Send + Sync>: Unpin, Arc<dyn Fn() -> Box<dyn Object + Send> + Send + Sync>: Unpin, Box<dyn DecodeEntry + Send>: Unpin, Box<dyn Object + Send>: Unpin, Rc<File>: Unpin, Rc<BString>: Unpin, *const LeafNode<String, Allow> is !null: Unpin, Box<(String, Allow)>: Unpin, Box<Path>: Unpin, Rc<SharedFileSnapshotMut<File>>: Unpin, Rc<SharedFileSnapshotMut<File>>: Unpin, Rc<SharedFileSnapshotMut<NonEmpty<ObjectId>>>: Unpin, *const LeafNode<String, (ObjectId, EntryKind)> is !null: Unpin, Box<(String, (ObjectId, EntryKind))>: Unpin, *const LeafNode<String, SetValZST> is !null: Unpin, Box<(String, SetValZST)>: Unpin,

§

impl UnsafeUnpin for MergeBase
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<SharedFileSnapshotMut<Buffer>> is !null: UnsafeUnpin, PhantomData<RcInner<SharedFileSnapshotMut<Buffer>>>: UnsafeUnpin, *const RcInner<Store> is !null: UnsafeUnpin, PhantomData<RcInner<Store>>: UnsafeUnpin, PhantomData<IndexLookup>: UnsafeUnpin, *const ArcInner<Vec<Store>> is !null: UnsafeUnpin, PhantomData<ArcInner<Vec<Store>>>: UnsafeUnpin, *mut u8: UnsafeUnpin, *mut i8: UnsafeUnpin, &'static mut State<'static>: UnsafeUnpin, *mut c_void: UnsafeUnpin, PhantomData<&'static ()>: UnsafeUnpin, *const ArcInner<dyn Fn() -> Box<dyn DecodeEntry + Send> + Send + Sync> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Fn() -> Box<dyn DecodeEntry + Send> + Send + Sync>>: UnsafeUnpin, *const ArcInner<dyn Fn() -> Box<dyn Object + Send> + Send + Sync> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Fn() -> Box<dyn Object + Send> + Send + Sync>>: UnsafeUnpin, *const dyn DecodeEntry + Send is !null: UnsafeUnpin, PhantomData<dyn DecodeEntry + Send>: UnsafeUnpin, *const dyn Object + Send is !null: UnsafeUnpin, PhantomData<dyn Object + Send>: UnsafeUnpin, PhantomData<(ObjectId, (Kind, Vec<u8>))>: UnsafeUnpin, PhantomData<Vec<u8>>: UnsafeUnpin, *const RcInner<File> is !null: UnsafeUnpin, PhantomData<RcInner<File>>: UnsafeUnpin, PhantomData<Replace>: UnsafeUnpin, *const LeafNode<String, Allow> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Allow)>>: UnsafeUnpin, PhantomData<BString>: UnsafeUnpin, *const Path is !null: UnsafeUnpin, PhantomData<Path>: UnsafeUnpin, *const RcInner<SharedFileSnapshotMut<File>> is !null: UnsafeUnpin, PhantomData<RcInner<SharedFileSnapshotMut<File>>>: UnsafeUnpin, *const RcInner<SharedFileSnapshotMut<File>> is !null: UnsafeUnpin, PhantomData<RcInner<SharedFileSnapshotMut<File>>>: UnsafeUnpin, *const RcInner<SharedFileSnapshotMut<NonEmpty<ObjectId>>> is !null: UnsafeUnpin, PhantomData<RcInner<SharedFileSnapshotMut<NonEmpty<ObjectId>>>>: UnsafeUnpin, *const LeafNode<String, (ObjectId, EntryKind)> is !null: UnsafeUnpin, PhantomData<Box<(String, (ObjectId, EntryKind))>>: UnsafeUnpin, *const LeafNode<String, SetValZST> is !null: UnsafeUnpin, PhantomData<Box<(String, SetValZST)>>: UnsafeUnpin,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more