--- a/bitbucket/converter.go Wed Jan 15 07:24:06 2020 -0600
+++ b/bitbucket/converter.go Wed Jan 15 07:36:50 2020 -0600
@@ -2,6 +2,7 @@
"hg.sr.ht/~grim/youtrack-import/youtrack"
@@ -91,51 +92,39 @@
- var ytComment *youtrack.Comment
- if comment.Content == "" {
- // if we don't have a content we need to build it from the log
- for _, log := range a.Logs {
- if log.Comment == comment.ID {
- if user, found := userMap[log.User.AccountID]; found {
- if log.Field == "content" {
- content = "edited description"
- ytComment = &youtrack.Comment{
- Created: log.CreatedOn,
+ // check if there were any stage changes with this comment + stateChanges := []string{} + for _, log := range a.Logs { + if log.Comment == comment.ID { + if log.Field == "content" { + stateChanges = append(stateChanges, "* edited description") + stateChanges = append(stateChanges, change)
- if user, found := userMap[comment.User.AccountID]; found {
+ if logContent := strings.Join(stateChanges, "\n"); logContent != "" { + comment.Content = logContent + "\n\n" + comment.Content - ytComment = &youtrack.Comment{
- Text: replaceKeywords(userMap, projectID, repository, comment.Content),
- Created: comment.CreatedOn,
- Updated: comment.UpdatedOn,
+ if user, found := userMap[comment.User.AccountID]; found { + ytComment := &youtrack.Comment{ + Text: replaceKeywords(userMap, projectID, repository, comment.Content), + Created: comment.CreatedOn, + Updated: comment.UpdatedOn, comments = append(comments, ytComment)