mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
feat(pr): merge with the repository's defaults, ready, gh flags and ✓ lines for pr mutations
pr merge takes the method from the repository's default merge style instead of always merging (D22), accepts gh's --merge, --squash and --rebase next to -s/--method, refuses methods the repository disables, and adds -d/--delete-branch (defaulting to the repository setting), --auto, -t, -b, -F and -e. On a terminal it asks for the method and branch deletion with the defaults preselected, without a picker when the current branch has a pull request. It reports "✓ Squashed and merged pull request alice/x#3 (title)", the deleted remote branch, and switches off and deletes the local head branch; --json returns the merged pull request. Merged, closed and draft pull requests are reported before anything is asked. -s without a value points at --squash. pr checkout names the local branch after the head branch when that name is free or already at the head, falling back to OWNER/BRANCH for forks and pr/NUMBER (D13), fetches and switches quietly, reports "✓ Checked out #1 into feat/one", and has the alias co. pr clean reports what it deleted and that a remote branch was already gone. pr create asks for the title and body, then "What's next?": submit, submit as a draft, add metadata or change the branches, without the AGit question up front or a final confirmation. It pushes an unpushed head with --set-upstream --quiet ("✓ Pushed feat/one to origin"), prints "✓ Created pull request alice/x#9 (title)" and the URL, and adds --fill, --web, the alias new, the gh shorthands, and milestones by title. New tea pr ready [--undo]. pr close and reopen take -c/--comment, close takes -d/--delete-branch, and both say when the pull request already is in that state. pr edit reports "✓ Edited", takes the singular gh reviewer flags (the plurals still work), milestones by title and --remove-milestone. pr diff is colored and paged on a terminal and byte-exact when piped, with --name-only, --color and --web. Every pull request argument accepts #N, URLs and branch names and defaults to the current branch's pull request. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
28 files changed
+1169
-504
No files matched your search
@@ -106,11 +106,9 @@ func TestUsageErrorsPrecedeRequests(t *testing.T) {
|
||||
{[]string{"pr", "attachment", "download", "1", "1", "--json"}, "attachment downloads are binary"},
|
||||
{[]string{"pr", "attachment", "download", "1", "1", "--output-file", "-", "--json=id"}, "attachment downloads are binary"},
|
||||
{[]string{"pr", "checkout", "7", "--detach", "--branch", "name"}, "--detach and --branch/--update are mutually exclusive"},
|
||||
{[]string{"pr", "create", "--milestone=-1"}, "--milestone must be a positive ID, or 0 for none"},
|
||||
{[]string{"pr", "create", "--milestone=-1"}, "--milestone must be a milestone title or a positive ID"},
|
||||
{[]string{"pr", "create", "--assignee", "alice, "}, "assignee names cannot be empty"},
|
||||
{[]string{"pr", "create", "--label", "bug, "}, "label names cannot be empty"},
|
||||
{[]string{"pr", "create", "--milestone-name="}, "--milestone-name cannot be empty"},
|
||||
{[]string{"pr", "create", "--milestone-name=Release", "--milestone=1"}, "--milestone and --milestone-name are mutually exclusive"},
|
||||
{[]string{"pr", "create", "--agit", "--json", "--title", "x", "--no-input"}, "--json/--jq cannot be combined with --agit"},
|
||||
{[]string{"pr", "create", "--topic", "x", "--title", "x", "--no-input"}, "--topic requires --agit"},
|
||||
{[]string{"pr", "create", "--reviewer", "bob, "}, "reviewer names cannot be empty"},
|
||||
@@ -120,8 +118,9 @@ func TestUsageErrorsPrecedeRequests(t *testing.T) {
|
||||
{[]string{"pr", "create", "--agit", "--remote", "origin", "--reviewer-team", "core"}, "--reviewer-team cannot be combined with --agit"},
|
||||
{[]string{"pr", "create", "--agit", "--remote", "origin", "--attachment", "log.txt"}, "--attachment cannot be combined with --agit"},
|
||||
{[]string{"pr", "create", "--attachment", "."}, ". is not a regular file"},
|
||||
{[]string{"pr", "edit", "7"}, "supply an edit flag"},
|
||||
{[]string{"pr", "edit", "7", "--remove-assignees="}, "supply an edit flag"},
|
||||
{[]string{"pr", "edit", "7"}, "nothing to edit; pass a flag such as --title (see tea pr edit --help)"},
|
||||
{[]string{"pr", "edit", "7", "--remove-assignees="}, "nothing to edit"},
|
||||
{[]string{"pr", "edit", "7", "--milestone", "1", "--remove-milestone"}, "--milestone and --remove-milestone are mutually exclusive"},
|
||||
{[]string{"pr", "edit", "7", "--draft", "--ready"}, "--draft and --ready are mutually exclusive"},
|
||||
{[]string{"pr", "edit", "7", "--title="}, "pull request title cannot be empty"},
|
||||
{[]string{"pr", "edit", "7", "--base="}, "--base cannot be empty"},
|
||||
|
||||
Reference in new issue
Block a user