(repo, prHead string, number int, title string, state string, isDraft bool)
| 111 | } |
| 112 | |
| 113 | func _stubPR(repo, prHead string, number int, title string, state string, isDraft bool) (ghrepo.Interface, *api.PullRequest) { |
| 114 | defaultBranch := "" |
| 115 | if idx := strings.IndexRune(repo, ':'); idx >= 0 { |
| 116 | defaultBranch = repo[idx+1:] |
| 117 | repo = repo[:idx] |
| 118 | } |
| 119 | baseRepo, err := ghrepo.FromFullName(repo) |
| 120 | if err != nil { |
| 121 | panic(err) |
| 122 | } |
| 123 | if defaultBranch != "" { |
| 124 | baseRepo = api.InitRepoHostname(&api.Repository{ |
| 125 | Name: baseRepo.RepoName(), |
| 126 | Owner: api.RepositoryOwner{Login: baseRepo.RepoOwner()}, |
| 127 | DefaultBranchRef: api.BranchRef{Name: defaultBranch}, |
| 128 | }, baseRepo.RepoHost()) |
| 129 | } |
| 130 | |
| 131 | idx := strings.IndexRune(prHead, ':') |
| 132 | headRefName := prHead[idx+1:] |
| 133 | headRepo, err := ghrepo.FromFullName(prHead[:idx]) |
| 134 | if err != nil { |
| 135 | panic(err) |
| 136 | } |
| 137 | |
| 138 | return baseRepo, &api.PullRequest{ |
| 139 | Number: number, |
| 140 | HeadRefName: headRefName, |
| 141 | HeadRepositoryOwner: api.Owner{Login: headRepo.RepoOwner()}, |
| 142 | HeadRepository: &api.PRRepository{Name: headRepo.RepoName()}, |
| 143 | IsCrossRepository: !ghrepo.IsSame(baseRepo, headRepo), |
| 144 | MaintainerCanModify: false, |
| 145 | |
| 146 | Title: title, |
| 147 | State: state, |
| 148 | IsDraft: isDraft, |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | type stubPRResolver struct { |
| 153 | pr *api.PullRequest |
no test coverage detected