prow/external-plugins/cherrypicker/server.go
func (s *Server) getPatch(org, repo, targetBranch string, num int) (string, error) {
	patch, err := s.ghc.GetPullRequestPatch(org, repo, num)
	if err != nil {
		return "", err
	}
	localPath := fmt.Sprintf("/tmp/%s_%s_%d_%s.patch", org, repo, num, normalize(targetBranch))
	out, err := os.Create(localPath)
	if err != nil {
		return "", err
	}
	defer out.Close()
	if _, err := io.Copy(out, bytes.NewBuffer(patch)); err != nil {
		return "", err
	}
	return localPath, nil
}
func (s *Server) getPatch(org, repo, targetBranch string, num int) (string, error) {
	patch, err := s.ghc.GetPullRequestPatch(org, repo, num)
	if err != nil {
		return "", err
	}
	localPath := fmt.Sprintf("/tmp/%s_%s_%d_%s.patch", org, repo, num, normalize(targetBranch))
	out, err := os.Create(localPath)
	if err != nil {
		return "", err
	}
	defer out.Close()
	if _, err := io.Copy(out, bytes.NewBuffer(patch)); err != nil {
		return "", err
	}
	return localPath, nil
}
func ( s * Server ) getPatch ( org , repo , targetBranch string , num int ) ( string , error ) { patch , err := s . ghc . GetPullRequestPatch ( org , repo , num ) if err != nil { return " " , err } localPath := fmt . Sprintf ( " " , org , repo , num , normalize ( targetBranch ) ) out , err := os . Create ( localPath ) if err != nil { return " " , err } defer out . Close ( ) if _ , err := io . Copy ( out , bytes . NewBuffer ( patch ) ) ; err != nil { return " " , err } return localPath , nil }
// getPatch gets the patch for the provided PR and creates a local
// copy of it. It returns its location in the filesystem and any
// encountered error.
getPatch gets the patch for the provided PR and creates a local copy of it . It returns its location in the filesystem and any encountered error .