pub struct GitLabReviewProvider<R: CommandRunner = RealCommandRunner> { /* private fields */ }Expand description
GitLab Review 提供者,通过 glab CLI 操作。
§Examples
use gitflow_gitlab::GitLabReviewProvider;
let provider = GitLabReviewProvider::new("gitlab-org/gitlab");Implementations§
Source§impl GitLabReviewProvider<RealCommandRunner>
impl GitLabReviewProvider<RealCommandRunner>
Sourcepub fn new(repo: impl Into<String>) -> GitLabReviewProvider<RealCommandRunner>
pub fn new(repo: impl Into<String>) -> GitLabReviewProvider<RealCommandRunner>
创建新的 GitLab Review 提供者。
repo 格式为 namespace/project。
Sourcepub fn with_session(session: &Session) -> Self
pub fn with_session(session: &Session) -> Self
Create a new provider from a shared [Session].
This enables state reuse across multiple operations in workflow chains.
Source§impl<R: CommandRunner> GitLabReviewProvider<R>
impl<R: CommandRunner> GitLabReviewProvider<R>
Sourcepub fn with_runner(repo: impl Into<String>, runner: R) -> Self
pub fn with_runner(repo: impl Into<String>, runner: R) -> Self
使用自定义 CommandRunner 创建提供者。
主要用于测试,可注入模拟 runner 以控制 glab CLI 的输出。
repo 格式为 namespace/project。
Trait Implementations§
Source§impl<R: Clone + CommandRunner> Clone for GitLabReviewProvider<R>
impl<R: Clone + CommandRunner> Clone for GitLabReviewProvider<R>
Source§impl<R: Debug + CommandRunner> Debug for GitLabReviewProvider<R>
impl<R: Debug + CommandRunner> Debug for GitLabReviewProvider<R>
Source§impl<R: CommandRunner + 'static> ReviewProvider for GitLabReviewProvider<R>
impl<R: CommandRunner + 'static> ReviewProvider for GitLabReviewProvider<R>
Source§fn comment<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
body: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn comment<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
body: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
在指定 MR 上添加审查评论。
调用 glab api --method POST 发布 note 评论并构造 ReviewData。
Source§fn approve<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
body: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn approve<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
body: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
批准指定 MR。
调用 glab mr approve 批准 MR,然后构造 ReviewData。
Source§fn request_changes<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
body: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn request_changes<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
body: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
对指定 MR 要求修改。
glab 没有直接的 “request changes” 命令,通过 glab api --method POST
发布包含要求修改意见的 note 评论,并标记为 ChangesRequested 状态。
Source§fn submit_review<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
event: ReviewState,
body: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn submit_review<'life0, 'life1, 'async_trait>(
&'life0 self,
pr_number: u64,
event: ReviewState,
body: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
提交指定 MR 的审查。
根据 event 参数分别调用 glab mr approve、glab mr revoke 或
glab mr note 实现不同的审查操作。
Auto Trait Implementations§
impl<R> Freeze for GitLabReviewProvider<R>where
R: Freeze,
impl<R> RefUnwindSafe for GitLabReviewProvider<R>where
R: RefUnwindSafe,
impl<R> Send for GitLabReviewProvider<R>
impl<R> Sync for GitLabReviewProvider<R>
impl<R> Unpin for GitLabReviewProvider<R>where
R: Unpin,
impl<R> UnsafeUnpin for GitLabReviewProvider<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for GitLabReviewProvider<R>where
R: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more