mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(pr,time,release): closed PRs for checkout and edit, dismiss state check first, worktree-aware checkout errors, exact piped durations (follow gh)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
11 files changed
+131
-23
No files matched your search
@@ -153,10 +153,9 @@ func (a *application) pullReviewDismissCommand(dismiss bool) *cobra.Command {
|
||||
var draft terminal.Draft
|
||||
defer finishDraft(&draft, &runErr)
|
||||
var err error
|
||||
if dismiss {
|
||||
if err := validateBodySources(cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
// The reason is collected before any request when it comes from flags or cannot be
|
||||
// prompted for; an editor or prompt waits until the review is known to be dismissable.
|
||||
collect := func() error {
|
||||
switch {
|
||||
case useEditor:
|
||||
draft, err = a.editDraft(cmd, "")
|
||||
@@ -172,6 +171,24 @@ func (a *application) pullReviewDismissCommand(dismiss bool) *cobra.Command {
|
||||
if strings.TrimSpace(body) == "" {
|
||||
return clierr.Wrap(clierr.Usage, errors.New("a dismissal needs a reason; pass --body, --body-file or --editor"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
collected := false
|
||||
if dismiss {
|
||||
if err := validateBodySources(cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
snapshot, err := a.settings()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
flagged := cmd.Flags().Changed("body") || cmd.Flags().Changed("body-file")
|
||||
if !useEditor && (flagged || !a.policy(snapshot).CanPrompt(a.deps.Streams)) {
|
||||
if err := collect(); err != nil {
|
||||
return err
|
||||
}
|
||||
collected = true
|
||||
}
|
||||
}
|
||||
t, n, id, err := a.pullAndID(cmd, args)
|
||||
if err != nil {
|
||||
@@ -191,6 +208,11 @@ func (a *application) pullReviewDismissCommand(dismiss bool) *cobra.Command {
|
||||
a.warn(cmd, "%s is not dismissed", subject)
|
||||
return a.jsonResult(cmd, current)
|
||||
}
|
||||
if dismiss && !collected {
|
||||
if err := collect(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if dismiss {
|
||||
if err := a.confirmAction(cmd, terminal.Confirmation{Prompt: "Dismiss " + subject + "?"}); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user