Support auto detecting branch for PRs #525
No reviewers
Labels
No Label
kind/breaking
kind/bug
kind/build
kind/dependency
kind/deployment
kind/docs
kind
enhancement
kind
feature
kind/proposal
kind
question
kind
refactor
kind/security
kind/testing
kind/translation
priority/critical
priority/high
priority/low
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/has-backport
status/has-pull
status/needs-backport
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
upstream/sdk
No Milestone
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/tea#525
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "harryzcy/tea:fix-524"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix #524
@ -71,0 +92,4 @@
}
for _, pr := range prs {
if pr.Head.Ref == branch {
Maybe we should list multiple PRs in terminal and user could chose one.
@ -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,
You can send
HeadBranch
orBaseBranch
as options.I don't see that in
ListPullRequestsOptions
@ -71,0 +108,4 @@
// then get the rest of the PRs
i := 1
for _, pr := range prs {
if pr.Head.Ref != branch {
We will get all pull requests which base branch or head branch is the current branch via
ListRepoPullRequests
. So maybe you meanpr.Base.Ref == branch
?@ -71,0 +119,4 @@
Options: prOptions,
PageSize: 10,
}
survey.AskOne(q, &selected)
This error should probably be checked.
@ -71,0 +114,4 @@
}
selected := ""
q := &survey.Select{
if it gets interactive it should go into https://gitea.com/gitea/tea/src/branch/main/modules/interact
CI tell us we have a lint issue
Fixed
@ -54,2 +55,4 @@
// If no PR index is provided, try interactive mode
return interact.MergePull(ctx)
}
for more readable.
Fixed in 9fdfb1
@ -0,0 +1,90 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
change to 2023?
Fixed in 96ccce
@ -0,0 +1,25 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
change to 2023
Fixed in 96ccce
@ -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{
paginate over api ...