@@ -187,50 +187,6 @@ impl GithubRepositoryClient {
187187 Ok ( prs)
188188 }
189189
190- pub async fn get_pull_request_commits (
191- & self ,
192- number : PullRequestNumber ,
193- ) -> anyhow:: Result < Vec < Commit > > {
194- let commits = perform_retryable (
195- "get_pull_request_commits" ,
196- RetryMethod :: default ( ) ,
197- || async {
198- let response = self
199- . client
200- . pulls ( self . repository ( ) . owner ( ) , self . repository ( ) . name ( ) )
201- . pr_commits ( number. 0 )
202- . per_page ( 100 )
203- . send ( )
204- . await
205- . map_err ( |error| {
206- anyhow:: anyhow!(
207- "Could not get PR {}#{number}: {error:?}" ,
208- self . repository( )
209- )
210- } ) ?;
211-
212- let mut commits = Vec :: new ( ) ;
213- let mut stream = std:: pin:: pin!( response. into_stream( & self . client) ) ;
214- while let Some ( gh_commit) = stream. try_next ( ) . await ? {
215- let commit = Commit {
216- sha : CommitSha ( gh_commit. sha ) ,
217- parents : gh_commit
218- . parents
219- . into_iter ( )
220- . filter_map ( |p| p. sha . map ( CommitSha ) )
221- . collect ( ) ,
222- tree : TreeSha ( gh_commit. commit . tree . sha ) ,
223- author : CommitAuthor :: from_gh ( gh_commit. commit . author ) ,
224- } ;
225- commits. push ( commit) ;
226- }
227- anyhow:: Ok ( commits)
228- } ,
229- )
230- . await ?;
231- Ok ( commits)
232- }
233-
234190 /// Post a comment to the pull request with the given number.
235191 /// The comment will be posted as the Github App user of the bot.
236192 pub async fn post_comment (
@@ -264,34 +220,7 @@ impl GithubRepositoryClient {
264220 force : ForcePush ,
265221 ) -> Result < ( ) , crate :: github:: api:: operations:: BranchUpdateError > {
266222 perform_retryable ( "set_branch_to_sha" , RetryMethod :: default ( ) , || async {
267- set_branch_to_commit ( self , self . repository ( ) , branch. to_string ( ) , sha, force)
268- . await
269- . map_err ( |e| match e {
270- error @ ( BranchUpdateError :: Conflict ( _)
271- | BranchUpdateError :: ValidationFailed ( _) ) => ShouldRetry :: No ( error) ,
272- error => ShouldRetry :: Yes ( error) ,
273- } )
274- } )
275- . await
276- . map_err ( |error| match error {
277- RetryableOpError :: Err ( error) => error,
278- RetryableOpError :: AllAttemptsExhausted ( _) => BranchUpdateError :: Timeout ,
279- } )
280- }
281-
282- /// Set the given branch **of a fork** to a commit with the given `sha`.
283- /// Must not be called on the same repository of this client.
284- pub async fn set_fork_branch_to_sha (
285- & self ,
286- repo : & GithubRepoName ,
287- branch : & str ,
288- sha : & CommitSha ,
289- force : ForcePush ,
290- ) -> Result < ( ) , crate :: github:: api:: operations:: BranchUpdateError > {
291- assert_ne ! ( self . repository( ) , repo) ;
292-
293- perform_retryable ( "set_fork_branch_to_sha" , RetryMethod :: default ( ) , || async {
294- set_branch_to_commit ( self , repo, branch. to_string ( ) , sha, force)
223+ set_branch_to_commit ( self , branch. to_string ( ) , sha, force)
295224 . await
296225 . map_err ( |e| match e {
297226 error @ ( BranchUpdateError :: Conflict ( _)
@@ -310,7 +239,7 @@ impl GithubRepositoryClient {
310239 pub async fn create_branch ( & self , branch : & str , sha : & CommitSha ) -> anyhow:: Result < ( ) > {
311240 perform_retryable ( "create_branch" , RetryMethod :: default ( ) , || async {
312241 anyhow:: Ok (
313- create_branch ( self , self . repository ( ) , branch. to_string ( ) , sha)
242+ create_branch ( self , branch. to_string ( ) , sha)
314243 . await
315244 . map_err ( |err| anyhow:: anyhow!( "{err}" ) ) ?,
316245 )
@@ -800,27 +729,12 @@ pub struct CheckRunOutput {
800729 pub summary : String ,
801730}
802731
803- #[ derive( Debug , Clone , PartialEq , Eq ) ]
732+ #[ derive( Debug ) ]
804733pub struct CommitAuthor {
805734 pub name : String ,
806735 pub email : String ,
807736}
808737
809- impl CommitAuthor {
810- pub fn from_gh ( gh_author : Option < octocrab:: models:: repos:: CommitAuthor > ) -> Option < Self > {
811- if let Some ( author) = gh_author
812- && let Some ( email) = author. email
813- {
814- Some ( Self {
815- name : author. name ,
816- email,
817- } )
818- } else {
819- None
820- }
821- }
822- }
823-
824738#[ cfg( test) ]
825739mod tests {
826740 use crate :: github:: GithubRepoName ;
0 commit comments