Skip to main content

GitHub

Struct GitHub 

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

The GitHub implementation of RemoteHost, driven through gh.

Every method is one gh invocation, and the program that answers as gh is the seam a journey substitutes: GitHub’s decisioning is what a test replaces, never the git underneath it.

Implementations§

Source§

impl GitHub

Source

pub fn new(repo: impl Into<String>) -> Result<Self>

Address this host at one repository, named owner/name.

Checked here rather than at each call: the slug is interpolated into every gh --repo invocation, and a value that is not one repository is a value that addresses something nobody asked for.

Trait Implementations§

Source§

impl Clone for GitHub

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitHub

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for GitHub

Source§

impl PartialEq for GitHub

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl RemoteHost for GitHub

Source§

fn check_log(&self, cr: &ChangeRequest, check: &Check) -> Result<ArtifactId>

Store one check’s log as an artifact, or refuse.

A fetch that did not produce the log is an error and no artifact: an artifact reads as what the check printed, so one holding the reason there is none is a lie in the only record a consumer has. A caller that must not fail over a missing log declines to fail over this error, as crate::publish does.

Source§

fn describe_change( &self, cr: &ChangeRequest, title: Option<&str>, body: &str, ) -> Result<()>

One gh pr edit, handing the body over as a file.

A file rather than --body, because a body is prose of unbounded size and an argument vector is not where multi-line Markdown belongs: the same reason onevcs publish takes --body-file. The file is written under a scratch directory that goes when this returns, and gh reads it before then.

Source§

fn change_description(&self, cr: &ChangeRequest) -> Result<Description>

One gh pr view, reading exactly the two fields a description is.

A response missing either is refused rather than read as empty: “the change request has no body” and “the host would not say what the body is” are different facts, and a caller finishing a description off what it reads here would otherwise start from a blank the host never answered.

Source§

fn is_draft(&self, cr: &ChangeRequest) -> Result<bool>

One gh pr view, reading the one field the host decides a draft by.

A response that does not carry it is refused rather than read as “not a draft”: what this decides is whether a change may be asked to merge, and “could not look” reported as “nothing is holding it” is the one answer that lands work somebody held back.

Source§

fn merged_at(&self, cr: &ChangeRequest) -> Result<Option<Sha>>

One gh pr view, reading exactly the two fields a merge is decided from — the same read merge makes, through the same parser, so watching a change request and merging one cannot come to disagree about what merged means.

Source§

fn authenticated_user(&self) -> Result<String>

Who the host believes is calling.
Source§

fn open_change(&self, req: ChangeSpec) -> Result<ChangeRequest>

Open a change request.
Source§

fn find_changes(&self, head: &str, base: &str) -> Result<Vec<ChangeRequest>>

Every open change request from head into base.
Source§

fn change_checks(&self, cr: &ChangeRequest) -> Result<ChangeChecks>

The checks the host is reporting on a change request, and which of its sources that answer was read from.
Source§

fn merge(&self, cr: &ChangeRequest, policy: MergePolicy) -> Result<MergeOutcome>

Merge a change request under a policy.
Source§

fn ready_for_review(&self, cr: &ChangeRequest) -> Result<()>

Take a change request out of its draft state, so the host will let it land. Read more
Source§

fn required_checks_on(&self, base: &str) -> Result<RequiredChecks>

The checks the repository requires before anything merges into base, asked of the branch itself rather than of a change request targeting it. Read more
Source§

impl StructuralPartialEq for GitHub

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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.