func getReviewCommit(repo repository.Repo, r request.Request, args []string) (string, string, error) {
	if len(args) > 1 {
		return "", "", errors.New("Only updating a single review is supported.")
	}
	if len(args) == 1 {
		base, err := repo.MergeBase(r.TargetRef, args[0])
		if err != nil {
			return "", "", err
		}
		return args[0], base, nil
	}
	base, err := repo.MergeBase(r.TargetRef, r.ReviewRef)
	if err != nil {
		return "", "", err
	}
	reviewCommits, err := repo.ListCommitsBetween(base, r.ReviewRef)
	if err != nil {
		return "", "", err
	}
	if reviewCommits == nil {
		return "", "", errors.New("There are no commits included in the review request")
	}
	return reviewCommits[0], base, nil
}
Get the commit at which the review request should be anchored.
package commands
import (
	"errors"
	"flag"
	"fmt"
	"strings"
	"github.com/google/git-appraise/commands/input"
	"github.com/google/git-appraise/repository"
	"github.com/google/git-appraise/review/gpg"
	"github.com/google/git-appraise/review/request"
)
const requestSummaryTemplate = `Review requested:
Commit: %s
Target Ref: %s
Review Ref: %s
Message: "%s"
`
var requestFlagSet = flag.NewFlagSet("request", flag.ExitOnError)
var (
	requestMessageFile      = requestFlagSet.String("F", "", "Take the comment from the given file. Use - to read the message from the standard input")
	requestMessage          = requestFlagSet.String("m", "", "Message to attach to the review")
	requestReviewers        = requestFlagSet.String("r", "", "Comma-separated list of reviewers")
	requestSource           = requestFlagSet.String("source", "HEAD", "Revision to review")
	requestTarget           = requestFlagSet.String("target", "refs/heads/master", "Revision against which to review")
	requestQuiet            = requestFlagSet.Bool("quiet", false, "Suppress review summary output")
	requestAllowUncommitted = requestFlagSet.Bool("allow-uncommitted", false, "Allow uncommitted local changes.")
	requestSign             = requestFlagSet.Bool("S", false,
		"GPG sign the content of the request")
)
func buildRequestFromFlags(requester string) (request.Request, error) {
	var reviewers []string
	if len(*requestReviewers) > 0 {
		for _, reviewer := range strings.Split(*requestReviewers, ",") {
			reviewers = append(reviewers, strings.TrimSpace(reviewer))
		}
	}
	if *requestMessageFile != "" && *requestMessage == "" {
		var err error
		*requestMessage, err = input.FromFile(*requestMessageFile)
		if err != nil {
			return request.Request{}, err
		}
	}
	return request.New(requester, reviewers, *requestSource, *requestTarget, *requestMessage), nil
}