@@ -125,11 +125,31 @@ func state(status string) changes.State { panic("unreachable") } } func (s service) ListCommits(ctx context.Context, _ string, id uint64, opt *changes.ListCommitsOptions) ([]changes.Commit, error) { return nil, fmt.Errorf("ListCommits: not implemented") change, _, err := s.cl.Changes.GetChange(fmt.Sprint(id), &gerrit.ChangeOptions{ AdditionalFields: []string{"DETAILED_ACCOUNTS", "ALL_REVISIONS"}, //AdditionalFields: []string{"ALL_REVISIONS", "ALL_COMMITS"}, // TODO: Consider using git committer/author instead... }) if err != nil { return nil, err } if change.Status == "DRAFT" { return nil, os.ErrNotExist } commits := make([]changes.Commit, len(change.Revisions)) for sha, r := range change.Revisions { commits[r.Number-1] = changes.Commit{ SHA: sha, Message: fmt.Sprintf("Patch Set %d", r.Number), // TODO: r.Uploader and r.Created describe the committer, not author. Author: s.gerritUser(r.Uploader), AuthorTime: time.Time(r.Created), } } return commits, nil } func (s service) GetDiff(ctx context.Context, _ string, id uint64, opt *changes.ListCommitsOptions) ([]byte, error) { diff, _, err := s.cl.Changes.GetPatch(fmt.Sprint(id), "current", &gerrit.PatchOptions{ Path: "src", // TODO.