PatchMut

Struct PatchMut 

Source
pub struct PatchMut<'a, 'g, R, C> {
    pub id: ObjectId,
    /* private fields */
}

Fields§

§id: ObjectId

Implementations§

Source§

impl<'a, 'g, R, C> PatchMut<'a, 'g, R, C>
where C: Update<Patch>, R: ReadRepository + SignRepository + Store<Namespace = NodeId>,

Source

pub fn new( id: ObjectId, patch: Patch, cache: &'g mut Cache<Patches<'a, R>, C>, ) -> Self

Source

pub fn id(&self) -> &ObjectId

Source

pub fn reload(&mut self) -> Result<(), Error>

Reload the patch data from storage.

Source

pub fn transaction<G, F>( &mut self, message: &str, signer: &Device<G>, operations: F, ) -> Result<EntryId, Error>
where G: Signer<Signature>, F: FnOnce(&mut Transaction<Patch, R>) -> Result<(), Error>,

Source

pub fn edit<G, S>( &mut self, title: Title, target: MergeTarget, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>, S: ToString,

Edit patch metadata.

Source

pub fn edit_revision<G, S>( &mut self, revision: RevisionId, description: S, embeds: impl IntoIterator<Item = Embed<Uri>>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>, S: ToString,

Edit revision metadata.

Source

pub fn redact<G>( &mut self, revision: RevisionId, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Redact a revision.

Source

pub fn thread<G, S>( &mut self, revision: RevisionId, body: S, signer: &Device<G>, ) -> Result<CommentId, Error>
where G: Signer<Signature>, S: ToString,

Create a thread on a patch revision.

Source

pub fn comment<G, S>( &mut self, revision: RevisionId, body: S, reply_to: Option<CommentId>, location: Option<CodeLocation>, embeds: impl IntoIterator<Item = Embed<Uri>>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>, S: ToString,

Comment on a patch revision.

Source

pub fn react<G>( &mut self, revision: RevisionId, reaction: Reaction, location: Option<CodeLocation>, active: bool, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

React on a patch revision.

Source

pub fn comment_edit<G, S>( &mut self, revision: RevisionId, comment: CommentId, body: S, embeds: impl IntoIterator<Item = Embed<Uri>>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>, S: ToString,

Edit a comment on a patch revision.

Source

pub fn comment_react<G>( &mut self, revision: RevisionId, comment: CommentId, reaction: Reaction, active: bool, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

React to a comment on a patch revision.

Source

pub fn comment_redact<G>( &mut self, revision: RevisionId, comment: CommentId, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Redact a comment on a patch revision.

Source

pub fn review_comment<G, S>( &mut self, review: ReviewId, body: S, location: Option<CodeLocation>, reply_to: Option<CommentId>, embeds: impl IntoIterator<Item = Embed<Uri>>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>, S: ToString,

Comment on a line of code as part of a review.

Source

pub fn edit_review_comment<G, S>( &mut self, review: ReviewId, comment: EntryId, body: S, embeds: impl IntoIterator<Item = Embed<Uri>>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>, S: ToString,

Edit review comment.

Source

pub fn react_review_comment<G>( &mut self, review: ReviewId, comment: EntryId, reaction: Reaction, active: bool, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

React to a review comment.

Source

pub fn redact_review_comment<G>( &mut self, review: ReviewId, comment: EntryId, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

React to a review comment.

Source

pub fn review<G>( &mut self, revision: RevisionId, verdict: Option<Verdict>, summary: Option<String>, labels: Vec<Label>, signer: &Device<G>, ) -> Result<ReviewId, Error>
where G: Signer<Signature>,

Review a patch revision.

Source

pub fn review_edit<G>( &mut self, review: ReviewId, verdict: Option<Verdict>, summary: String, labels: Vec<Label>, embeds: impl IntoIterator<Item = Embed<Uri>>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Edit a review.

Source

pub fn review_react<G>( &mut self, review: ReviewId, reaction: Reaction, active: bool, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

React to a review.

Source

pub fn redact_review<G>( &mut self, review: ReviewId, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Redact a patch review.

Source

pub fn resolve_review_comment<G>( &mut self, review: ReviewId, comment: CommentId, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Resolve a patch review comment.

Source

pub fn unresolve_review_comment<G>( &mut self, review: ReviewId, comment: CommentId, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Unresolve a patch review comment.

Source

pub fn merge<G>( &mut self, revision: RevisionId, commit: Oid, signer: &Device<G>, ) -> Result<Merged<'_, R>, Error>
where G: Signer<Signature>,

Merge a patch revision.

Source

pub fn update<G>( &mut self, description: impl ToString, base: impl Into<Oid>, oid: impl Into<Oid>, signer: &Device<G>, ) -> Result<RevisionId, Error>
where G: Signer<Signature>,

Update a patch with a new revision.

Source

pub fn lifecycle<G>( &mut self, state: Lifecycle, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Lifecycle a patch.

Source

pub fn assign<G>( &mut self, assignees: BTreeSet<Did>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Assign a patch.

Source

pub fn archive<G>(&mut self, signer: &Device<G>) -> Result<bool, Error>
where G: Signer<Signature>,

Archive a patch.

Source

pub fn unarchive<G>(&mut self, signer: &Device<G>) -> Result<bool, Error>
where G: Signer<Signature>,

Mark an archived patch as ready to be reviewed again. Returns false if the patch was not archived.

Source

pub fn ready<G>(&mut self, signer: &Device<G>) -> Result<bool, Error>
where G: Signer<Signature>,

Mark a patch as ready to be reviewed. Returns false if the patch was not a draft.

Source

pub fn unready<G>(&mut self, signer: &Device<G>) -> Result<bool, Error>
where G: Signer<Signature>,

Mark an open patch as a draft. Returns false if the patch was not open and free of merges.

Source

pub fn label<G>( &mut self, labels: impl IntoIterator<Item = Label>, signer: &Device<G>, ) -> Result<EntryId, Error>
where G: Signer<Signature>,

Label a patch.

Methods from Deref<Target = Patch>§

Source

pub fn title(&self) -> &str

Title of the patch.

Source

pub fn state(&self) -> &State

Current state of the patch.

Source

pub fn target(&self) -> MergeTarget

Target this patch is meant to be merged in.

Source

pub fn timestamp(&self) -> Timestamp

Timestamp of the first revision of the patch.

Source

pub fn labels(&self) -> impl Iterator<Item = &Label>

Associated labels.

Source

pub fn description(&self) -> &str

Patch description.

Source

pub fn embeds(&self) -> &[Embed<Uri>]

Patch embeds.

Source

pub fn author(&self) -> &Author

Author of the first revision of the patch.

Source

pub fn authors(&self) -> BTreeSet<&Author>

All revision authors.

Source

pub fn revision(&self, id: &RevisionId) -> Option<&Revision>

Get the Revision by its RevisionId.

None is returned if the Revision has been redacted (deleted).

Source

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.

Source

pub fn revisions( &self, ) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>

List of all patch revisions by all authors.

Source

pub fn revisions_by<'a>( &'a self, author: &'a PublicKey, ) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)>

List of patch revisions by the given author.

Source

pub fn reviews_of( &self, rev: RevisionId, ) -> impl Iterator<Item = (&ReviewId, &Review)>

List of patch reviews of the given revision.

Source

pub fn assignees(&self) -> impl Iterator<Item = Did> + '_

List of patch assignees.

Source

pub fn merges(&self) -> impl Iterator<Item = (&ActorId, &Merge)>

Get the merges.

Source

pub fn head(&self) -> &Oid

Reference to the Git object containing the code on the latest revision.

Source

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.

Source

pub fn merge_base<R: ReadRepository>(&self, repo: &R) -> Result<Oid, Error>

Get the merge base of this patch.

Source

pub fn range(&self) -> Result<(Oid, Oid), Error>

Get the commit range of this patch.

Source

pub fn version(&self) -> RevisionIx

Index of latest revision in the revisions list.

Source

pub fn root(&self) -> (RevisionId, &Revision)

Root revision.

This is the revision that was created with the patch.

Source

pub fn latest(&self) -> (RevisionId, &Revision)

Latest revision by the patch author.

Source

pub fn latest_by<'a>( &'a self, author: &'a PublicKey, ) -> Option<(RevisionId, &'a Revision)>

Latest revision by the given author.

Source

pub fn updated_at(&self) -> Timestamp

Time of last update.

Source

pub fn is_merged(&self) -> bool

Check if the patch is merged.

Source

pub fn is_open(&self) -> bool

Check if the patch is open.

Source

pub fn is_archived(&self) -> bool

Check if the patch is archived.

Source

pub fn is_draft(&self) -> bool

Check if the patch is a draft.

Source

pub fn authorization( &self, action: &Action, actor: &ActorId, doc: &Doc, ) -> Result<Authorization, Error>

Apply authorization rules on patch actions.

Trait Implementations§

Source§

impl<R, C> Deref for PatchMut<'_, '_, R, C>

Source§

type Target = Patch

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a, 'g, R, C> Freeze for PatchMut<'a, 'g, R, C>

§

impl<'a, 'g, R, C> RefUnwindSafe for PatchMut<'a, 'g, R, C>

§

impl<'a, 'g, R, C> Send for PatchMut<'a, 'g, R, C>
where C: Send, R: Sync,

§

impl<'a, 'g, R, C> Sync for PatchMut<'a, 'g, R, C>
where C: Sync, R: Sync,

§

impl<'a, 'g, R, C> Unpin for PatchMut<'a, 'g, R, C>

§

impl<'a, 'g, R, C> !UnwindSafe for PatchMut<'a, 'g, R, C>

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, 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,