fix(taskwarrior): merge identifies if there are changes in the comments
This commit is contained in:
@@ -363,7 +363,6 @@ func (issue *Issue) MergeTask(task taskwarrior.Task) taskwarrior.Task {
|
|||||||
task.Status = diff.Prompt(task.Status, issue.git_issue.State, task.Status)
|
task.Status = diff.Prompt(task.Status, issue.git_issue.State, task.Status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: try to automatically derive the correct required changes
|
|
||||||
var annotations []string
|
var annotations []string
|
||||||
for _, annotation := range task.Annotations {
|
for _, annotation := range task.Annotations {
|
||||||
annotations = append(annotations, annotation.Description)
|
annotations = append(annotations, annotation.Description)
|
||||||
@@ -372,18 +371,25 @@ func (issue *Issue) MergeTask(task taskwarrior.Task) taskwarrior.Task {
|
|||||||
for _, comment := range issue.comments {
|
for _, comment := range issue.comments {
|
||||||
comments = append(comments, comment.Body)
|
comments = append(comments, comment.Body)
|
||||||
}
|
}
|
||||||
// FIXME: provide options for theirs, mine and manual edit of the task annotations
|
require_merge := false
|
||||||
// FIXME: prompted for no right reason
|
if len(annotations) == len(comments) {
|
||||||
// FIXME: changes the task incorrectly
|
for i := range annotations {
|
||||||
annotation_joined := diff.Prompt(strings.Join(annotations, "\n\n"), strings.Join(comments, "\n\n"), strings.Join(annotations, "\n\n"))
|
if annotations[i] != comments[i] {
|
||||||
for i, description := range strings.Split(annotation_joined, "\n\n") {
|
require_merge = true
|
||||||
if len(description) == 0 {
|
}
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if i < len(task.Annotations) {
|
}
|
||||||
task.Annotations[i].Description = description
|
if require_merge {
|
||||||
} else {
|
annotation_joined := diff.Prompt(strings.Join(annotations, "\n\n"), strings.Join(comments, "\n\n"), strings.Join(annotations, "\n\n"))
|
||||||
task.AppendComment(-1, description, time.Now().In(time.Local))
|
for i, description := range strings.Split(annotation_joined, "\n\n") {
|
||||||
|
if len(description) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if i < len(task.Annotations) {
|
||||||
|
task.Annotations[i].Description = description
|
||||||
|
} else {
|
||||||
|
task.AppendComment(-1, description, time.Now().In(time.Local))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user