Support auto detecting branch for PRs #525

Open
harryzcy wants to merge 17 commits from harryzcy/tea:fix-524 into main
First-time contributor

Fix #524

Fix #524
harryzcy added 1 commit 2023-01-04 08:24:07 +00:00
Support auto detecting branch for PRs
Some checks failed
continuous-integration/drone/pr Build is failing
bff965e84c
harryzcy added 1 commit 2023-01-04 19:29:19 +00:00
Make function unexported
All checks were successful
continuous-integration/drone/pr Build is passing
e4ff7b8397
lunny reviewed 2023-01-06 07:58:23 +00:00
@ -71,0 +92,4 @@
}
for _, pr := range prs {
if pr.Head.Ref == branch {
Owner

Maybe we should list multiple PRs in terminal and user could chose one.

Maybe we should list multiple PRs in terminal and user could chose one.
harryzcy marked this conversation as resolved
harryzcy added 1 commit 2023-01-07 22:47:28 +00:00
List multiple PRs and offer choice
All checks were successful
continuous-integration/drone/pr Build is passing
5a0ac6e1e8
lunny reviewed 2023-01-09 05:15:48 +00:00
@ -71,0 +87,4 @@
func getPullIndex(ctx *context.TeaContext, branch string) (int64, error) {
prs, _, err := ctx.Login.Client().ListRepoPullRequests(ctx.Owner, ctx.Repo, gitea.ListPullRequestsOptions{
State: gitea.StateOpen,
Owner

You can send HeadBranch or BaseBranch as options.

You can send `HeadBranch` or `BaseBranch` as options.
Author
First-time contributor

I don't see that in ListPullRequestsOptions

// ListPullRequestsOptions options for listing pull requests
type ListPullRequestsOptions struct {
	ListOptions
	State StateType `json:"state"`
	// oldest, recentupdate, leastupdate, mostcomment, leastcomment, priority
	Sort      string
	Milestone int64
}
I don't see that in `ListPullRequestsOptions` ```go // ListPullRequestsOptions options for listing pull requests type ListPullRequestsOptions struct { ListOptions State StateType `json:"state"` // oldest, recentupdate, leastupdate, mostcomment, leastcomment, priority Sort string Milestone int64 } ```
6543 marked this conversation as resolved
lunny reviewed 2023-01-09 05:18:13 +00:00
@ -71,0 +108,4 @@
// then get the rest of the PRs
i := 1
for _, pr := range prs {
if pr.Head.Ref != branch {
Owner

We will get all pull requests which base branch or head branch is the current branch via ListRepoPullRequests. So maybe you mean pr.Base.Ref == branch?

We will get all pull requests which base branch or head branch is the current branch via `ListRepoPullRequests`. So maybe you mean `pr.Base.Ref == branch`?
harryzcy marked this conversation as resolved
harryzcy added 1 commit 2023-01-11 04:54:14 +00:00
Update branch filtering
All checks were successful
continuous-integration/drone/pr Build is passing
783d167f37
jolheiser reviewed 2023-02-09 04:30:33 +00:00
@ -71,0 +119,4 @@
Options: prOptions,
PageSize: 10,
}
survey.AskOne(q, &selected)
Owner

This error should probably be checked.

This error should probably be checked.
harryzcy marked this conversation as resolved
6543 added 1 commit 2023-02-15 22:01:07 +00:00
Merge branch 'main' into fix-524
All checks were successful
continuous-integration/drone/pr Build is passing
90e98063c8
6543 added 1 commit 2023-02-15 22:25:58 +00:00
Merge branch 'main' into fix-524
All checks were successful
continuous-integration/drone/pr Build is passing
f7587619f8
harryzcy added 1 commit 2023-02-21 19:48:19 +00:00
Check command line prompt error
All checks were successful
continuous-integration/drone/pr Build is passing
26a5c6bc49
harryzcy added 1 commit 2023-02-21 19:50:09 +00:00
Merge branch 'main' into fix-524
All checks were successful
continuous-integration/drone/pr Build is passing
8f0f19c5f8
6543 reviewed 2023-03-21 02:35:17 +00:00
@ -71,0 +114,4 @@
}
selected := ""
q := &survey.Select{
Owner

if it gets interactive it should go into https://gitea.com/gitea/tea/src/branch/main/modules/interact

if it gets interactive it should go into https://gitea.com/gitea/tea/src/branch/main/modules/interact
harryzcy marked this conversation as resolved
6543 added 1 commit 2023-04-02 21:52:03 +00:00
Merge branch 'main' into fix-524
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 1m55s
807fd93554
harryzcy added 1 commit 2023-04-03 22:49:38 +00:00
Move interactive part to interact package
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 1m7s
86bb8dbcb8
harryzcy added 1 commit 2023-04-03 22:50:55 +00:00
Merge branch 'main' into fix-524
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 28s
80e4b17749
6543 added the
kind
feature
label 2023-04-04 04:35:12 +00:00
6543 added this to the v0.10.0 milestone 2023-04-04 04:35:16 +00:00
Owner

CI tell us we have a lint issue

CI tell us we have a lint issue
harryzcy added 1 commit 2023-04-18 03:42:49 +00:00
Add copyright to fix lint
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 33s
3ce904ec7d
harryzcy added 1 commit 2023-04-18 03:43:42 +00:00
Merge branch 'main' into fix-524
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 30s
6413d72c22
Author
First-time contributor

CI tell us we have a lint issue

Fixed

> CI tell us we have a lint issue Fixed
appleboy requested changes 2023-05-04 08:54:12 +00:00
@ -54,2 +55,4 @@
// If no PR index is provided, try interactive mode
return interact.MergePull(ctx)
}
Member
if ctx.Args().Len() != 1 {
  return interact.MergePull(ctx)
}

for more readable.

```go if ctx.Args().Len() != 1 { return interact.MergePull(ctx) } ``` for more readable.
Author
First-time contributor

Fixed in 9fdfb1

Fixed in [9fdfb1](https://gitea.com/gitea/tea/commit/9fdfb1debca52f14bffeb68290a99e1ceadd202a)
lunny marked this conversation as resolved
@ -0,0 +1,90 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
Member

change to 2023?

change to 2023?
Author
First-time contributor

Fixed in 96ccce

Fixed in [96ccce](https://gitea.com/gitea/tea/commit/96cccedd3767ff5caa231edb1458d7652b3d6807)
lunny marked this conversation as resolved
@ -0,0 +1,25 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
Member

change to 2023

change to 2023
Author
First-time contributor

Fixed in 96ccce

Fixed in [96ccce](https://gitea.com/gitea/tea/commit/96cccedd3767ff5caa231edb1458d7652b3d6807)
lunny marked this conversation as resolved
harryzcy added 1 commit 2023-05-06 18:02:02 +00:00
Change copyright to 2023
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 1m33s
96cccedd37
harryzcy added 1 commit 2023-05-06 18:03:36 +00:00
Readibility update
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 51s
9fdfb1debc
harryzcy added 1 commit 2023-06-24 02:19:33 +00:00
Merge branch 'main' into fix-524
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 1m37s
404439f8fd
6543 reviewed 2023-07-05 18:35:16 +00:00
@ -0,0 +40,4 @@
// getPullIndex interactively determines the PR index
func getPullIndex(ctx *context.TeaContext, branch string) (int64, error) {
prs, _, err := ctx.Login.Client().ListRepoPullRequests(ctx.Owner, ctx.Repo, gitea.ListPullRequestsOptions{
Owner

paginate over api ...

paginate over api ...
6543 added 1 commit 2024-02-15 14:55:40 +00:00
Merge branch 'main' into fix-524
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 24s
6f81e5135b
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 24s
Required
Details
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u fix-524:harryzcy-fix-524
git checkout harryzcy-fix-524
Sign in to join this conversation.
No description provided.