pub struct Patch { /* private fields */ }Expand description
Patch state.
Implementations§
Source§impl Patch
impl Patch
Sourcepub fn new(
title: Title,
target: MergeTarget,
(id, revision): (RevisionId, Revision),
) -> Self
pub fn new( title: Title, target: MergeTarget, (id, revision): (RevisionId, Revision), ) -> Self
Construct a new patch object from a revision.
Sourcepub fn target(&self) -> MergeTarget
pub fn target(&self) -> MergeTarget
Target this patch is meant to be merged in.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Patch description.
Author of the first revision of the patch.
All revision authors.
Sourcepub fn revision(&self, id: &RevisionId) -> Option<&Revision>
pub fn revision(&self, id: &RevisionId) -> Option<&Revision>
Get the Revision by its RevisionId.
None is returned if the Revision has been redacted (deleted).
Sourcepub fn updates(
&self,
) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>
pub fn updates( &self, ) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>
List of patch revisions by the patch author. The initial changeset is part of the first revision.
Sourcepub fn revisions(
&self,
) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>
pub fn revisions( &self, ) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>
List of all patch revisions by all authors.
Sourcepub fn revisions_by<'a>(
&'a self,
author: &'a PublicKey,
) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)>
pub fn revisions_by<'a>( &'a self, author: &'a PublicKey, ) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)>
List of patch revisions by the given author.
Sourcepub fn reviews_of(
&self,
rev: RevisionId,
) -> impl Iterator<Item = (&ReviewId, &Review)>
pub fn reviews_of( &self, rev: RevisionId, ) -> impl Iterator<Item = (&ReviewId, &Review)>
List of patch reviews of the given revision.
Sourcepub fn head(&self) -> &Oid
pub fn head(&self) -> &Oid
Reference to the Git object containing the code on the latest revision.
Sourcepub fn base(&self) -> &Oid
pub fn base(&self) -> &Oid
Get the commit of the target branch on which this patch is based. This can change via a patch update.
Sourcepub fn merge_base<R: ReadRepository>(&self, repo: &R) -> Result<Oid, Error>
pub fn merge_base<R: ReadRepository>(&self, repo: &R) -> Result<Oid, Error>
Get the merge base of this patch.
Sourcepub fn version(&self) -> RevisionIx
pub fn version(&self) -> RevisionIx
Index of latest revision in the revisions list.
Sourcepub fn root(&self) -> (RevisionId, &Revision)
pub fn root(&self) -> (RevisionId, &Revision)
Root revision.
This is the revision that was created with the patch.
Sourcepub fn latest(&self) -> (RevisionId, &Revision)
pub fn latest(&self) -> (RevisionId, &Revision)
Latest revision by the patch author.
Sourcepub fn latest_by<'a>(
&'a self,
author: &'a PublicKey,
) -> Option<(RevisionId, &'a Revision)>
pub fn latest_by<'a>( &'a self, author: &'a PublicKey, ) -> Option<(RevisionId, &'a Revision)>
Latest revision by the given author.
Sourcepub fn updated_at(&self) -> Timestamp
pub fn updated_at(&self) -> Timestamp
Time of last update.
Sourcepub fn is_archived(&self) -> bool
pub fn is_archived(&self) -> bool
Check if the patch is archived.
Apply authorization rules on patch actions.
Trait Implementations§
Source§impl Cob for Patch
impl Cob for Patch
Source§impl CobWithType for Patch
impl CobWithType for Patch
Source§impl<'de> Deserialize<'de> for Patch
impl<'de> Deserialize<'de> for Patch
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<R: ReadRepository> Evaluate<R> for Patch
impl<R: ReadRepository> Evaluate<R> for Patch
Source§impl<R, C> Remove<Patch> for Cache<R, C>
impl<R, C> Remove<Patch> for Cache<R, C>
type RemoveError = <C as Remove<Patch>>::RemoveError
Source§fn remove(&mut self, id: &ObjectId) -> Result<Self::Out, Self::RemoveError>
fn remove(&mut self, id: &ObjectId) -> Result<Self::Out, Self::RemoveError>
Source§fn remove_all(&mut self, rid: &RepoId) -> Result<Self::Out, Self::RemoveError>
fn remove_all(&mut self, rid: &RepoId) -> Result<Self::Out, Self::RemoveError>
Source§impl Remove<Patch> for StoreWriter
impl Remove<Patch> for StoreWriter
type RemoveError = Error
Source§fn remove(&mut self, id: &ObjectId) -> Result<Self::Out, Self::RemoveError>
fn remove(&mut self, id: &ObjectId) -> Result<Self::Out, Self::RemoveError>
Source§fn remove_all(&mut self, rid: &RepoId) -> Result<Self::Out, Self::RemoveError>
fn remove_all(&mut self, rid: &RepoId) -> Result<Self::Out, Self::RemoveError>
Source§impl Update<Patch> for StoreWriter
impl Update<Patch> for StoreWriter
impl Eq for Patch
impl StructuralPartialEq for Patch
Auto Trait Implementations§
impl Freeze for Patch
impl RefUnwindSafe for Patch
impl Send for Patch
impl Sync for Patch
impl Unpin for Patch
impl UnwindSafe for Patch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.