Implement PR closing and reopening #304

Merged
6543 merged 4 commits from YakoYakoYokuYoku/tea:pull-close-open into master 2020-12-16 22:47:13 +00:00
Contributor

Fixes #301.

  • Try to not get a 403 as response, this likely means that the user is closing/reopening the PR as a repo owner instead of doing it as the PR owner as it should be expected. (See the upstream gitea issue.)
Fixes #301. - [x] ~~Try to not get a `403` as response, this likely means that the user is closing/reopening the PR as a repo owner instead of doing it as the PR owner as it should be expected.~~ (See the upstream [`gitea` issue](https://github.com/go-gitea/gitea/issues/14025).)
YakoYakoYokuYoku added 1 commit 2020-12-14 23:27:29 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
7a4910f8ab
Implement pull request closing/reopening
Signed-off-by: Martin Reboredo <yakoyoku@gmail.com>
YakoYakoYokuYoku changed title from Implement PR closing and reopening to WIP: Implement PR closing and reopening 2020-12-14 23:59:36 +00:00
lunny added the
kind
feature
label 2020-12-15 05:11:05 +00:00
lunny added this to the v0.7.0 milestone 2020-12-15 05:11:09 +00:00
6543 reviewed 2020-12-15 07:31:07 +00:00
Dismissed
@ -0,0 +1,25 @@
// Copyright 2018 The Gitea Authors. All rights reserved.
Owner

2020

2020
noerw marked this conversation as resolved
noerw requested changes 2020-12-15 10:59:31 +00:00
Dismissed
cmd/pulls.go Outdated
@ -24,2 +24,2 @@
Usage: "List, create, checkout and clean pull requests",
Description: `List, create, checkout and clean pull requests`,
Usage: "List, create, checkout, close, clean and reopen pull requests",
Description: `List, create, checkout, close, clean and reopen pull requests`,
Member

This is becoming a bit long. Maybe Manage & checkout pull requests?

This is becoming a bit long. Maybe `Manage & checkout pull requests`?
YakoYakoYokuYoku marked this conversation as resolved
Owner

@YakoYakoYokuYoku can you apply changes of #291 to your pull ?

@YakoYakoYokuYoku can you apply changes of #291 to your pull ?
YakoYakoYokuYoku added 4 commits 2020-12-15 20:44:03 +00:00
ea0ad62e0d
Add feature comparison chart between forge CLIs (#294)
WIP: add comparison

Merge branch 'master' into issue-194-comparison

move file

hint in readme

Co-authored-by: Norwin Roosen <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: #294
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-Authored-By: Norwin <noerw@noreply.gitea.io>
Co-Committed-By: Norwin <noerw@noreply.gitea.io>
9c08becd75
replace flag globals, require context for commands (#291)
introduce TeaContext

clean up InitCommand

move GetListOptions to TeaContext

ensure context for each command

so we fail early with a good error message instead of "Error: 404" etc

make linter happy

Merge branch 'master' into refactor-global-flags

move TeaContext & InitCommand to modules/context

Merge branch 'master' into refactor-global-flags

CI.restart()

Merge branch 'master' into refactor-global-flags

Merge branch 'master' into refactor-global-flags

Co-authored-by: Norwin Roosen <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: #291
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: khmarbaise <khmarbaise@noreply.gitea.io>
Reviewed-by: 6543 <6543@obermui.de>
Co-Authored-By: Norwin <noerw@noreply.gitea.io>
Co-Committed-By: Norwin <noerw@noreply.gitea.io>
All checks were successful
continuous-integration/drone/pr Build is passing
4a496c2108
Apply changes from #291
YakoYakoYokuYoku force-pushed pull-close-open from 4a496c2108 to 3c0a2acba2 2020-12-15 20:47:14 +00:00 Compare
YakoYakoYokuYoku requested review from noerw 2020-12-15 20:48:50 +00:00
Member

@YakoYakoYokuYoku

  • Try to not get a 403 as response.

In my tests it works. You could show a more descriptive error in case it fails, though I think it's fine as it is.

  • Empty arguments so tea deletes/reopens the current PR.

I think this should be in another PR, as this requires detection what the current PR is. This is a feature that is generally neat to have (such as in tea open pull)

@YakoYakoYokuYoku > - [ ] Try to not get a `403` as response. In my tests it works. You could show a more descriptive error in case it fails, though I think it's fine as it is. > - [ ] Empty arguments so `tea` deletes/reopens the current PR. I think this should be in another PR, as this requires detection what the current PR is. This is a feature that is generally neat to have (such as in `tea open pull`)
noerw reviewed 2020-12-15 22:02:04 +00:00
Dismissed
@ -0,0 +20,4 @@
func editPullState(ctx *cli.Context, opts gitea.EditPullRequestOption) error {
login, owner, repo := config.InitCommand(flags.GlobalRepoValue, flags.GlobalLoginValue, flags.GlobalRemoteValue)
if ctx.Args().Len() == 0 {
log.Fatal(ctx.Command.ArgsUsage)
Member
- log.Fatal(ctx.Command.ArgsUsage)
+ return fmt.Errorf("Please provide a PR index")
```diff - log.Fatal(ctx.Command.ArgsUsage) + return fmt.Errorf("Please provide a PR index")
YakoYakoYokuYoku marked this conversation as resolved
Owner
  • Empty arguments so tea deletes/reopens the current PR.

I think this should be in another PR, as this requires detection what the current PR is. This is a feature that is generally neat to have (such as in tea open pull)

pull review commands will ned this too - something teaContext should ;)

@YakoYakoYokuYoku I agree with moving this into it's own pull

> > - [ ] Empty arguments so `tea` deletes/reopens the current PR. > > I think this should be in another PR, as this requires detection what the current PR is. This is a feature that is generally neat to have (such as in `tea open pull`) pull review commands will ned this too - something teaContext should ;) @YakoYakoYokuYoku I agree with moving this into it's own pull
Owner

@YakoYakoYokuYoku if you need help to apply latest changes to your pull - just ask

@YakoYakoYokuYoku if you need help to apply latest changes to your pull - just ask
Author
Contributor

I wasn't having any issues with merging commits, I was taking my time setting up my local Gitea instance for testing with this PR.

Testing revealed that I can close a PR, if I have permissions in the repo to do so. I suppose that this PR is for closing PRs as the repo owner, not the PR owner ?.

I wasn't having any issues with merging commits, I was taking my time setting up my local Gitea instance for testing with this PR. Testing revealed that I can close a PR, if I have permissions in the repo to do so. I suppose that this PR is for closing PRs as the repo owner, not the PR owner ?.
YakoYakoYokuYoku force-pushed pull-close-open from 3c0a2acba2 to 5810292885 2020-12-16 21:07:23 +00:00 Compare
Member

Oh, now I get it & can reproduce. That's indeed an (upstream API) issue:
You should certainly be allowed to close your own PR.

I think we can merge this anyway and fix it upstream
https://github.com/go-gitea/gitea/issues/14025

Oh, now I get it & can reproduce. That's indeed an (upstream API) issue: You should certainly be allowed to close your own PR. I think we can merge this anyway and fix it upstream https://github.com/go-gitea/gitea/issues/14025
YakoYakoYokuYoku force-pushed pull-close-open from 5810292885 to ed9f5bbd4c 2020-12-16 21:12:39 +00:00 Compare
Author
Contributor

Since the PR 403 issue is not a blocker for this PR I also agree for merging.

Since the PR `403` issue is not a blocker for this PR I also agree for merging.
YakoYakoYokuYoku changed title from WIP: Implement PR closing and reopening to Implement PR closing and reopening 2020-12-16 21:18:40 +00:00
noerw approved these changes 2020-12-16 21:24:23 +00:00
Dismissed
noerw added the
status/needs-reviews
label 2020-12-16 21:29:36 +00:00
appleboy approved these changes 2020-12-16 22:34:27 +00:00
Dismissed
6543 removed the
status/needs-reviews
label 2020-12-16 22:46:14 +00:00
6543 merged commit a2e8b47c57 into master 2020-12-16 22:47:13 +00:00
Sign in to join this conversation.
No description provided.