dmitri.shuralyov.com/service/change/...

gerritapi: Support merged event.
dmitshur committed 7 years ago commit ed13ed9e29207d46c15c6f900bd5c0b4d63f272a
Collapse all
gerritapi/gerritapi.go
@@ -262,10 +262,21 @@ func (s service) ListTimeline(ctx context.Context, _ string, id uint64, opt *cha
			Editable:  false,
		})
	}
	for idx, message := range change.Messages {
		if strings.HasPrefix(message.Tag, "autogenerated:") {
			switch message.Tag[len("autogenerated:"):] {
			case "gerrit:merged":
				timeline = append(timeline, changes.TimelineItem{
					Actor:     s.gerritUser(message.Author),
					CreatedAt: time.Time(message.Date),
					Payload: changes.MergedEvent{
						CommitID: message.Message[46:86], // TODO: Make safer.
						RefName:  change.Branch,
					},
				})
			}
			continue
		}
		label, body, ok := parseMessage(message.Message)
		if !ok {
			continue