add resolution to dup'd issues when necessary

This commit is contained in:
Cory Bennett
2017-09-03 00:38:37 -07:00
parent ad1a62a88d
commit 2638396606
2 changed files with 29 additions and 2 deletions
+14 -2
View File
@@ -72,19 +72,31 @@ func CmdDup(o *oreo.Client, globals *jiracli.GlobalOptions, opts *DupOptions) er
if err != nil {
return err
}
for _, trans := range []string{"close", "done", "start", "stop"} {
for _, trans := range []string{"close", "done", "cancel", "start", "stop"} {
transMeta := meta.Transitions.Find(trans)
if transMeta != nil {
issueUpdate := jiradata.IssueUpdate{
Transition: transMeta,
}
resolution := defaultResolution(transMeta)
if resolution != "" {
issueUpdate.Fields = map[string]interface{}{
"resolution": map[string]interface{}{
"name": resolution,
},
}
}
if err = jira.TransitionIssue(o, globals.Endpoint.Value, opts.InwardIssue.Key, &issueUpdate); err != nil {
return err
}
// if we just started the issue now we need to stop it
if trans != "start" {
break
}
// if we are here then we must be stopping, so need to reset the meta
meta, err = jira.GetIssueTransitions(o, globals.Endpoint.Value, opts.InwardIssue.Key)
if err != nil {
return err
}
}
}