// SetPullRequest sets the PullRequest field's value.
774849
func (s *UpdatePullRequestStatusOutput) SetPullRequest(v *PullRequest) *UpdatePullRequestStatusOutput {
	s.PullRequest = v
	return s
}
1213890
func (s *PutEventsInput) SetEventsRequest(v *EventsRequest) *PutEventsInput {
	s.EventsRequest = v
	return s
}
386729
func (s *DescribePullRequestEventsInput) SetPullRequestEventType(v string) *DescribePullRequestEventsInput {
	s.PullRequestEventType = &v
	return s
}
170358
func (e *ErrorEntry) SetRequest(r *http.Request) *ErrorEntry {
	e.Request = httpdata.NewHTTPRequest(r)
	return e
}
422782
func (s *UpdateSecretInput) SetClientRequestToken(v string) *UpdateSecretInput {
	s.ClientRequestToken = &v
	return s
}
157124
func (s *PullRequest) SetPullRequestId(v string) *PullRequest {
	s.PullRequestId = &v
	return s
}
1292343
func (s *UpdateApnsVoipSandboxChannelInput) SetAPNSVoipSandboxChannelRequest(v *APNSVoipSandboxChannelRequest) *UpdateApnsVoipSandboxChannelInput {
	s.APNSVoipSandboxChannelRequest = v
	return s
}
762851
func (s *ListPullRequestsOutput) SetPullRequestIds(v []*string) *ListPullRequestsOutput {
	s.PullRequestIds = v
	return s
}
1092543
func (client Client) GetPullRequest(projectKey, projectSlug, identifier string) (PullRequest, error) {
	retry := retry.New(3, retry.DefaultBackoffFunc)
	var data []byte
	work := func() error {
		req, err := http.NewRequest(
			"GET",
			fmt.Sprintf(
				"%s/rest/api/1.0/projects/%s/repos/%s/pull-requests/%s",
				client.baseURL.String(), projectKey, projectSlug, identifier,
			),
			nil,
		)
		if err != nil {
			return err
		}
		req.Header.Set("Accept", "application/json")
		// use credentials if we have them.  If not, the repository must be public.
		if client.userName != "" && client.password != "" {
			req.SetBasicAuth(client.userName, client.password)
		}

		var responseCode int
		responseCode, data, err = client.consumeResponse(req)
		if err != nil {
			return err
		}
		if responseCode != http.StatusOK {
			reason := "unhandled reason"
			switch {
			case responseCode == http.StatusBadRequest:
				reason = "Bad request."
			case responseCode == http.StatusUnauthorized:
				reason = "The currently authenticated user has insufficient permissions to see a pull request."
			case responseCode == http.StatusNotFound:
				reason = "The resource was not found. Does the project key exist?"
			}
			return errorResponse{StatusCode: responseCode, Reason: reason}
		}
		return nil
	}
	if err := retry.Try(work); err != nil {
		return PullRequest{}, err
	}

	var r PullRequest
	err := json.Unmarshal(data, &r)
	if err != nil {
		return PullRequest{}, err
	}

	return r, nil
}
748231
func (s *PublishInput) SetPayload(v []byte) *PublishInput {
	s.Payload = v
	return s
}
350660
func (s *PullRequestStatusChangedEventMetadata) SetPullRequestStatus(v string) *PullRequestStatusChangedEventMetadata {
	s.PullRequestStatus = &v
	return s
}
95752
func (s *RotateSecretInput) SetClientRequestToken(v string) *RotateSecretInput {
	s.ClientRequestToken = &v
	return s
}
667308
func (repo *Repository) GetPullRequestInfo(basePath, baseBranch, headBranch string) (_ *PullRequestInfo, err error) {
	var remoteBranch string

	// We don't need a temporary remote for same repository.
	if repo.Path != basePath {
		// Add a temporary remote
		tmpRemote := strconv.FormatInt(time.Now().UnixNano(), 10)
		if err = repo.AddRemote(tmpRemote, basePath, true); err != nil {
			return nil, fmt.Errorf("AddRemote: %v", err)
		}
		defer repo.RemoveRemote(tmpRemote)

		remoteBranch = "remotes/" + tmpRemote + "/" + baseBranch
	} else {
		remoteBranch = baseBranch
	}

	prInfo := new(PullRequestInfo)
	prInfo.MergeBase, err = repo.GetMergeBase(remoteBranch, headBranch)
	if err != nil {
		return nil, err
	}

	logs, err := NewCommand("log", prInfo.MergeBase+"..."+headBranch, _PRETTY_LOG_FORMAT).RunInDirBytes(repo.Path)
	if err != nil {
		return nil, err
	}
	prInfo.Commits, err = repo.parsePrettyFormatLogToList(logs)
	if err != nil {
		return nil, fmt.Errorf("parsePrettyFormatLogToList: %v", err)
	}

	// Count number of changed files.
	stdout, err := NewCommand("diff", "--name-only", remoteBranch+"..."+headBranch).RunInDir(repo.Path)
	if err != nil {
		return nil, err
	}
	prInfo.NumFiles = len(strings.Split(stdout, "\n")) - 1

	return prInfo, nil
}
26044
func (s *MergePullRequestByFastForwardOutput) SetPullRequest(v *PullRequest) *MergePullRequestByFastForwardOutput {
	s.PullRequest = v
	return s
}
1250589
func setPayload(p *testpb.Payload, t testpb.PayloadType, size int) {
	if size < 0 {
		grpclog.Fatalf("Requested a response with invalid length %d", size)
	}
	body := make([]byte, size)
	switch t {
	case testpb.PayloadType_COMPRESSABLE:
	case testpb.PayloadType_UNCOMPRESSABLE:
		grpclog.Fatalf("PayloadType UNCOMPRESSABLE is not supported")
	default:
		grpclog.Fatalf("Unsupported payload type: %d", t)
	}
	p.Type = t
	p.Body = body
}
451295
func (s *GetCommentsForPullRequestInput) SetPullRequestId(v string) *GetCommentsForPullRequestInput {
	s.PullRequestId = &v
	return s
}
540276
func (s *PullRequestEvent) SetPullRequestEventType(v string) *PullRequestEvent {
	s.PullRequestEventType = &v
	return s
}