Skip to content

Add a ListCommits method for reviews. #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions review/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,19 @@ func (r *Review) GetBaseCommit() (string, error) {
return r.Repo.MergeBase(leftHandSide, rightHandSide)
}

// ListCommits lists the commits included in a review.
func (r *Review) ListCommits() ([]string, error) {
baseCommit, err := r.GetBaseCommit()
if err != nil {
return nil, err
}
headCommit, err := r.GetHeadCommit()
if err != nil {
return nil, err
}
return r.Repo.ListCommitsBetween(baseCommit, headCommit)
}

// GetDiff returns the diff for a review.
func (r *Review) GetDiff(diffArgs ...string) (string, error) {
var baseCommit, headCommit string
Expand Down