make merge base SHA not nullable

This commit is contained in:
Marko Gaćeša 2023-04-25 17:38:48 +02:00
parent 345540594f
commit be3b68e577
39 changed files with 768 additions and 342 deletions

View File

@ -197,3 +197,30 @@ func (c *Client) GetCommitDivergences(ctx context.Context,
return output, nil return output, nil
} }
type MergeBaseParams struct {
ReadParams
Ref1 string
Ref2 string
}
type MergeBaseOutput struct {
MergeBaseSHA string
}
func (c *Client) MergeBase(ctx context.Context,
params MergeBaseParams,
) (MergeBaseOutput, error) {
result, err := c.repoService.MergeBase(ctx, &rpc.MergeBaseRequest{
Base: mapToRPCReadRequest(params.ReadParams),
Ref1: params.Ref1,
Ref2: params.Ref2,
})
if err != nil {
return MergeBaseOutput{}, fmt.Errorf("failed to get merge base commit: %w", err)
}
return MergeBaseOutput{
MergeBaseSHA: result.MergeBaseSha,
}, nil
}

View File

@ -162,8 +162,9 @@ type GetDiffHunkHeadersParams struct {
} }
type DiffFileHeader struct { type DiffFileHeader struct {
OldName string OldName string
NewName string NewName string
Extensions map[string]string
} }
type HunkHeader struct { type HunkHeader struct {

View File

@ -0,0 +1,20 @@
// Copyright 2022 Harness Inc. All rights reserved.
// Use of this source code is governed by the Polyform Free Trial License
// that can be found in the LICENSE.md file for this repository.
package enum
// Diff file header extensions. From: https://git-scm.com/docs/git-diff#generate_patch_text_with_p
const (
DiffExtHeaderOldMode = "old mode" // old mode <mode>
DiffExtHeaderNewMode = "new mode" // new mode <mode>
DiffExtHeaderDeletedFileMode = "deleted file mode" // deleted file mode <mode>
DiffExtHeaderNewFileMode = "new file mode" // new file mode <mode>
DiffExtHeaderCopyFrom = "copy from" // copy from <path>
DiffExtHeaderCopyTo = "copy to" // copy to <path>
DiffExtHeaderRenameFrom = "rename from" // rename from <path>
DiffExtHeaderRenameTo = "rename to" // rename to <path>
DiffExtHeaderSimilarity = "similarity index" // similarity index <number>
DiffExtHeaderDissimilarity = "dissimilarity index" // dissimilarity index <number>
DiffExtHeaderIndex = "index" // index <hash>..<hash> <mode>
)

View File

@ -36,6 +36,7 @@ type Interface interface {
ListCommitTags(ctx context.Context, params *ListCommitTagsParams) (*ListCommitTagsOutput, error) ListCommitTags(ctx context.Context, params *ListCommitTagsParams) (*ListCommitTagsOutput, error)
GetCommitDivergences(ctx context.Context, params *GetCommitDivergencesParams) (*GetCommitDivergencesOutput, error) GetCommitDivergences(ctx context.Context, params *GetCommitDivergencesParams) (*GetCommitDivergencesOutput, error)
CommitFiles(ctx context.Context, params *CommitFilesParams) (CommitFilesResponse, error) CommitFiles(ctx context.Context, params *CommitFilesParams) (CommitFilesResponse, error)
MergeBase(ctx context.Context, params MergeBaseParams) (MergeBaseOutput, error)
/* /*
* Git Cli Service * Git Cli Service

View File

@ -41,7 +41,7 @@ func (g Adapter) GetLatestCommit(ctx context.Context, repoPath string,
return mapGiteaCommit(giteaCommit) return mapGiteaCommit(giteaCommit)
} }
// giteaGetCommitByPath is a copy of gitea code - required as we want latest commit per specific branch. // giteaGetCommitByPath returns the latest commit per specific branch.
func giteaGetCommitByPath(giteaRepo *gitea.Repository, ref string, treePath string) (*gitea.Commit, error) { func giteaGetCommitByPath(giteaRepo *gitea.Repository, ref string, treePath string) (*gitea.Commit, error) {
if treePath == "" { if treePath == "" {
treePath = "." treePath = "."
@ -54,7 +54,9 @@ func giteaGetCommitByPath(giteaRepo *gitea.Repository, ref string, treePath stri
return nil, fmt.Errorf("failed to trigger log command: %w", runErr) return nil, fmt.Errorf("failed to trigger log command: %w", runErr)
} }
giteaCommits, err := giteaParsePrettyFormatLogToList(giteaRepo, stdout) lines := parseLinesToSlice(stdout)
giteaCommits, err := getGiteaCommits(giteaRepo, lines)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -62,19 +64,16 @@ func giteaGetCommitByPath(giteaRepo *gitea.Repository, ref string, treePath stri
return giteaCommits[0], nil return giteaCommits[0], nil
} }
// giteaParsePrettyFormatLogToList is an exact copy of gitea code. func getGiteaCommits(giteaRepo *gitea.Repository, commitIDs []string) ([]*gitea.Commit, error) {
func giteaParsePrettyFormatLogToList(giteaRepo *gitea.Repository, logs []byte) ([]*gitea.Commit, error) {
var giteaCommits []*gitea.Commit var giteaCommits []*gitea.Commit
if len(logs) == 0 { if len(commitIDs) == 0 {
return giteaCommits, nil return giteaCommits, nil
} }
parts := bytes.Split(logs, []byte{'\n'}) for _, commitID := range commitIDs {
commit, err := giteaRepo.GetCommit(commitID)
for _, commitID := range parts {
commit, err := giteaRepo.GetCommit(string(commitID))
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to get commit '%s': %w", string(commitID), err) return nil, fmt.Errorf("failed to get commit '%s': %w", commitID, err)
} }
giteaCommits = append(giteaCommits, commit) giteaCommits = append(giteaCommits, commit)
} }
@ -82,17 +81,10 @@ func giteaParsePrettyFormatLogToList(giteaRepo *gitea.Repository, logs []byte) (
return giteaCommits, nil return giteaCommits, nil
} }
// ListCommits lists the commits reachable from ref. func (g Adapter) listCommitSHAs(giteaRepo *gitea.Repository,
// Note: ref & afterRef can be Branch / Tag / CommitSHA. ref string, afterRef string,
// Note: commits returned are [ref->...->afterRef). page int, limit int,
func (g Adapter) ListCommits(ctx context.Context, repoPath string, ) ([]string, error) {
ref string, afterRef string, page int, limit int) ([]types.Commit, error) {
giteaRepo, err := gitea.OpenRepository(ctx, repoPath)
if err != nil {
return nil, err
}
defer giteaRepo.Close()
args := []string{"rev-list"} args := []string{"rev-list"}
// add pagination if requested // add pagination if requested
@ -120,7 +112,46 @@ func (g Adapter) ListCommits(ctx context.Context, repoPath string,
return nil, processGiteaErrorf(runErr, "failed to trigger rev-list command") return nil, processGiteaErrorf(runErr, "failed to trigger rev-list command")
} }
giteaCommits, err := giteaParsePrettyFormatLogToList(giteaRepo, bytes.TrimSpace(stdout)) return parseLinesToSlice(stdout), nil
}
// ListCommitSHAs lists the commits reachable from ref.
// Note: ref & afterRef can be Branch / Tag / CommitSHA.
// Note: commits returned are [ref->...->afterRef).
func (g Adapter) ListCommitSHAs(ctx context.Context,
repoPath string,
ref string, afterRef string,
page int, limit int,
) ([]string, error) {
giteaRepo, err := gitea.OpenRepository(ctx, repoPath)
if err != nil {
return nil, err
}
defer giteaRepo.Close()
return g.listCommitSHAs(giteaRepo, ref, afterRef, page, limit)
}
// ListCommits lists the commits reachable from ref.
// Note: ref & afterRef can be Branch / Tag / CommitSHA.
// Note: commits returned are [ref->...->afterRef).
func (g Adapter) ListCommits(ctx context.Context,
repoPath string,
ref string, afterRef string,
page int, limit int,
) ([]types.Commit, error) {
giteaRepo, err := gitea.OpenRepository(ctx, repoPath)
if err != nil {
return nil, err
}
defer giteaRepo.Close()
commitSHAs, err := g.listCommitSHAs(giteaRepo, ref, afterRef, page, limit)
if err != nil {
return nil, err
}
giteaCommits, err := getGiteaCommits(giteaRepo, commitSHAs)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -264,3 +295,18 @@ func (g Adapter) getCommitDivergence(ctx context.Context, repoPath string,
Behind: int32(right), Behind: int32(right),
}, nil }, nil
} }
func parseLinesToSlice(output []byte) []string {
if len(output) == 0 {
return nil
}
lines := bytes.Split(bytes.TrimSpace(output), []byte{'\n'})
slice := make([]string, len(lines))
for i, line := range lines {
slice[i] = string(line)
}
return slice
}

View File

@ -9,6 +9,7 @@ import (
"io" "io"
"regexp" "regexp"
"github.com/harness/gitness/gitrpc/enum"
"github.com/harness/gitness/gitrpc/internal/types" "github.com/harness/gitness/gitrpc/internal/types"
) )
@ -23,9 +24,34 @@ func ParseDiffFileHeader(line string) (types.DiffFileHeader, bool) {
return types.DiffFileHeader{ return types.DiffFileHeader{
OldFileName: groups[1], OldFileName: groups[1],
NewFileName: groups[2], NewFileName: groups[2],
Extensions: map[string]string{},
}, true }, true
} }
var regExpDiffExtHeader = regexp.MustCompile(
"^(" +
enum.DiffExtHeaderOldMode + "|" +
enum.DiffExtHeaderNewMode + "|" +
enum.DiffExtHeaderDeletedFileMode + "|" +
enum.DiffExtHeaderNewFileMode + "|" +
enum.DiffExtHeaderCopyFrom + "|" +
enum.DiffExtHeaderCopyTo + "|" +
enum.DiffExtHeaderRenameFrom + "|" +
enum.DiffExtHeaderRenameTo + "|" +
enum.DiffExtHeaderSimilarity + "|" +
enum.DiffExtHeaderDissimilarity + "|" +
enum.DiffExtHeaderIndex +
") (.+)$")
func ParseDiffFileExtendedHeader(line string) (string, string) {
groups := regExpDiffExtHeader.FindStringSubmatch(line)
if groups == nil {
return "", ""
}
return groups[1], groups[2]
}
// GetHunkHeaders parses git diff output and returns all diff headers for all files. // GetHunkHeaders parses git diff output and returns all diff headers for all files.
// See for documentation: https://git-scm.com/docs/git-diff#generate_patch_text_with_p // See for documentation: https://git-scm.com/docs/git-diff#generate_patch_text_with_p
func GetHunkHeaders(r io.Reader) ([]*types.DiffFileHunkHeaders, error) { func GetHunkHeaders(r io.Reader) ([]*types.DiffFileHunkHeaders, error) {
@ -49,14 +75,20 @@ func GetHunkHeaders(r io.Reader) ([]*types.DiffFileHunkHeaders, error) {
continue continue
} }
if currentFile == nil {
// should not happen: we reached the hunk header without first finding the file header.
return nil, types.ErrHunkNotFound
}
if h, ok := ParseDiffHunkHeader(line); ok { if h, ok := ParseDiffHunkHeader(line); ok {
if currentFile == nil {
// should not happen: we reached the hunk header without first finding the file header.
return nil, types.ErrHunkNotFound
}
currentFile.HunksHeaders = append(currentFile.HunksHeaders, h) currentFile.HunksHeaders = append(currentFile.HunksHeaders, h)
continue continue
} }
if headerKey, headerValue := ParseDiffFileExtendedHeader(line); headerKey != "" {
currentFile.FileHeader.Extensions[headerKey] = headerValue
continue
}
} }
if err := scanner.Err(); err != nil { if err := scanner.Err(); err != nil {

View File

@ -8,6 +8,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/harness/gitness/gitrpc/enum"
"github.com/harness/gitness/gitrpc/internal/types" "github.com/harness/gitness/gitrpc/internal/types"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
@ -20,9 +21,9 @@ index 0000000..fb0c863
--- /dev/null --- /dev/null
+++ b/new_file.txt +++ b/new_file.txt
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
This is a new file +This is a new file
created for this +created for this
unit test. +unit test.
diff --git a/old_file_name.txt b/changed_file.txt diff --git a/old_file_name.txt b/changed_file.txt
index f043b93..e9449b5 100644 index f043b93..e9449b5 100644
--- a/changed_file.txt --- a/changed_file.txt
@ -56,18 +57,38 @@ index f043b93..0000000
want := []*types.DiffFileHunkHeaders{ want := []*types.DiffFileHunkHeaders{
{ {
FileHeader: types.DiffFileHeader{OldFileName: "new_file.txt", NewFileName: "new_file.txt"}, FileHeader: types.DiffFileHeader{
OldFileName: "new_file.txt",
NewFileName: "new_file.txt",
Extensions: map[string]string{
enum.DiffExtHeaderNewFileMode: "100644",
enum.DiffExtHeaderIndex: "0000000..fb0c863",
},
},
HunksHeaders: []types.HunkHeader{{OldLine: 0, OldSpan: 0, NewLine: 1, NewSpan: 3}}, HunksHeaders: []types.HunkHeader{{OldLine: 0, OldSpan: 0, NewLine: 1, NewSpan: 3}},
}, },
{ {
FileHeader: types.DiffFileHeader{OldFileName: "old_file_name.txt", NewFileName: "changed_file.txt"}, FileHeader: types.DiffFileHeader{
OldFileName: "old_file_name.txt",
NewFileName: "changed_file.txt",
Extensions: map[string]string{
enum.DiffExtHeaderIndex: "f043b93..e9449b5 100644",
},
},
HunksHeaders: []types.HunkHeader{ HunksHeaders: []types.HunkHeader{
{OldLine: 7, OldSpan: 3, NewLine: 7, NewSpan: 4}, {OldLine: 7, OldSpan: 3, NewLine: 7, NewSpan: 4},
{OldLine: 27, OldSpan: 2, NewLine: 28, NewSpan: 3}, {OldLine: 27, OldSpan: 2, NewLine: 28, NewSpan: 3},
}, },
}, },
{ {
FileHeader: types.DiffFileHeader{OldFileName: "deleted_file.txt", NewFileName: "deleted_file.txt"}, FileHeader: types.DiffFileHeader{
OldFileName: "deleted_file.txt",
NewFileName: "deleted_file.txt",
Extensions: map[string]string{
enum.DiffExtHeaderDeletedFileMode: "100644",
enum.DiffExtHeaderIndex: "f043b93..0000000",
},
},
HunksHeaders: []types.HunkHeader{{OldLine: 1, OldSpan: 3, NewLine: 0, NewSpan: 0}}, HunksHeaders: []types.HunkHeader{{OldLine: 1, OldSpan: 3, NewLine: 0, NewSpan: 0}},
}, },
} }

View File

@ -134,3 +134,19 @@ func (s RepositoryService) GetCommitDivergences(ctx context.Context,
return response, nil return response, nil
} }
func (s RepositoryService) MergeBase(ctx context.Context,
r *rpc.MergeBaseRequest,
) (*rpc.MergeBaseResponse, error) {
base := r.GetBase()
repoPath := getFullPathForRepo(s.reposRoot, base.GetRepoUid())
mergeBase, _, err := s.adapter.GetMergeBase(ctx, repoPath, "", r.Ref1, r.Ref2)
if err != nil {
return nil, processGitErrorf(err, "failed to find merge base")
}
return &rpc.MergeBaseResponse{
MergeBaseSha: mergeBase,
}, nil
}

View File

@ -124,7 +124,7 @@ func (s DiffService) DiffCut(
return nil, processGitErrorf(err, "failed to find merge base") return nil, processGitErrorf(err, "failed to find merge base")
} }
sourceCommits, err := s.adapter.ListCommits(ctx, repoPath, r.SourceBranch, r.TargetBranch, 0, 1) sourceCommits, err := s.adapter.ListCommitSHAs(ctx, repoPath, r.SourceBranch, r.TargetBranch, 0, 1)
if err != nil || len(sourceCommits) == 0 { if err != nil || len(sourceCommits) == 0 {
return nil, processGitErrorf(err, "failed to get list of source branch commits") return nil, processGitErrorf(err, "failed to get list of source branch commits")
} }
@ -146,6 +146,6 @@ func (s DiffService) DiffCut(
HunkHeader: mapHunkHeader(hunk.HunkHeader), HunkHeader: mapHunkHeader(hunk.HunkHeader),
Lines: hunk.Lines, Lines: hunk.Lines,
MergeBaseSha: mergeBase, MergeBaseSha: mergeBase,
LatestSourceSha: sourceCommits[0].SHA, LatestSourceSha: sourceCommits[0],
}, nil }, nil
} }

View File

@ -33,6 +33,8 @@ type GitAdapter interface {
GetCommits(ctx context.Context, repoPath string, refs []string) ([]types.Commit, error) GetCommits(ctx context.Context, repoPath string, refs []string) ([]types.Commit, error)
ListCommits(ctx context.Context, repoPath string, ListCommits(ctx context.Context, repoPath string,
ref string, afterRef string, page int, limit int) ([]types.Commit, error) ref string, afterRef string, page int, limit int) ([]types.Commit, error)
ListCommitSHAs(ctx context.Context, repoPath string,
ref string, afterRef string, page int, limit int) ([]string, error)
GetLatestCommit(ctx context.Context, repoPath string, ref string, treePath string) (*types.Commit, error) GetLatestCommit(ctx context.Context, repoPath string, ref string, treePath string) (*types.Commit, error)
GetFullCommitID(ctx context.Context, repoPath, shortID string) (string, error) GetFullCommitID(ctx context.Context, repoPath, shortID string) (string, error)
GetAnnotatedTag(ctx context.Context, repoPath string, sha string) (*types.Tag, error) GetAnnotatedTag(ctx context.Context, repoPath string, sha string) (*types.Tag, error)

View File

@ -122,6 +122,7 @@ func mapDiffFileHeader(h types.DiffFileHeader) *rpc.DiffFileHeader {
return &rpc.DiffFileHeader{ return &rpc.DiffFileHeader{
OldFileName: h.OldFileName, OldFileName: h.OldFileName,
NewFileName: h.NewFileName, NewFileName: h.NewFileName,
Extensions: h.Extensions,
} }
} }

View File

@ -260,6 +260,7 @@ type DiffShortStat struct {
type DiffFileHeader struct { type DiffFileHeader struct {
OldFileName string OldFileName string
NewFileName string NewFileName string
Extensions map[string]string
} }
type DiffFileHunkHeaders struct { type DiffFileHunkHeaders struct {

View File

@ -238,7 +238,8 @@ func mapHunkHeader(h *rpc.HunkHeader) HunkHeader {
func mapDiffFileHeader(h *rpc.DiffFileHeader) DiffFileHeader { func mapDiffFileHeader(h *rpc.DiffFileHeader) DiffFileHeader {
return DiffFileHeader{ return DiffFileHeader{
OldName: h.OldFileName, OldName: h.OldFileName,
NewName: h.NewFileName, NewName: h.NewFileName,
Extensions: h.Extensions,
} }
} }

View File

@ -46,6 +46,7 @@ message HunkHeader {
message DiffFileHeader { message DiffFileHeader {
string old_file_name = 1; string old_file_name = 1;
string new_file_name = 2; string new_file_name = 2;
map<string, string> extensions = 3;
} }
message DiffFileHunkHeaders { message DiffFileHunkHeaders {

View File

@ -16,6 +16,7 @@ service RepositoryService {
rpc GetCommit(GetCommitRequest) returns (GetCommitResponse); rpc GetCommit(GetCommitRequest) returns (GetCommitResponse);
rpc GetCommitDivergences(GetCommitDivergencesRequest) returns (GetCommitDivergencesResponse); rpc GetCommitDivergences(GetCommitDivergencesRequest) returns (GetCommitDivergencesResponse);
rpc DeleteRepository(DeleteRepositoryRequest) returns (DeleteRepositoryResponse); rpc DeleteRepository(DeleteRepositoryRequest) returns (DeleteRepositoryResponse);
rpc MergeBase(MergeBaseRequest) returns (MergeBaseResponse);
} }
message CreateRepositoryRequest { message CreateRepositoryRequest {
@ -163,4 +164,14 @@ message DeleteRepositoryRequest {
} }
message DeleteRepositoryResponse { message DeleteRepositoryResponse {
} }
message MergeBaseRequest {
ReadRequest base = 1;
string ref1 = 2;
string ref2 = 3;
}
message MergeBaseResponse {
string merge_base_sha = 1;
}

View File

@ -289,8 +289,9 @@ type DiffFileHeader struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
OldFileName string `protobuf:"bytes,1,opt,name=old_file_name,json=oldFileName,proto3" json:"old_file_name,omitempty"` OldFileName string `protobuf:"bytes,1,opt,name=old_file_name,json=oldFileName,proto3" json:"old_file_name,omitempty"`
NewFileName string `protobuf:"bytes,2,opt,name=new_file_name,json=newFileName,proto3" json:"new_file_name,omitempty"` NewFileName string `protobuf:"bytes,2,opt,name=new_file_name,json=newFileName,proto3" json:"new_file_name,omitempty"`
Extensions map[string]string `protobuf:"bytes,3,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
} }
func (x *DiffFileHeader) Reset() { func (x *DiffFileHeader) Reset() {
@ -339,6 +340,13 @@ func (x *DiffFileHeader) GetNewFileName() string {
return "" return ""
} }
func (x *DiffFileHeader) GetExtensions() map[string]string {
if x != nil {
return x.Extensions
}
return nil
}
type DiffFileHunkHeaders struct { type DiffFileHunkHeaders struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -725,90 +733,98 @@ var file_diff_proto_rawDesc = []byte{
0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08,
0x6e, 0x65, 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x6e, 0x65, 0x77, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x6e, 0x65, 0x77, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18,
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x58, 0x0a, 0x0e, 0x44, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0xdc, 0x01, 0x0a, 0x0e,
0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x22,
0x0d, 0x6f, 0x6c, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x0a, 0x0d, 0x6f, 0x6c, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x6c, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x6c, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61,
0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x65, 0x77, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x65, 0x77, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x77, 0x46, 0x69, 0x6c, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x77, 0x46, 0x69,
0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7f, 0x0a, 0x13, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
0x65, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x34, 0x0a, 0x0b, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, 0x70, 0x63,
0x66, 0x69, 0x6c, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e,
0x0b, 0x32, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x48, 0x65, 0x61, 0x64, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3d, 0x0a, 0x0f, 0x45,
0x65, 0x72, 0x12, 0x32, 0x0a, 0x0c, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0b, 0x68, 0x75, 0x6e, 0x6b, 0x48, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x44, 0x69, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x7f, 0x0a, 0x13, 0x44, 0x69,
0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x73, 0x12, 0x34, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66,
0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x66, 0x69, 0x6c,
0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x0c, 0x68, 0x75, 0x6e, 0x6b, 0x5f,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
0x6d, 0x69, 0x74, 0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0b,
0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x68, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x19,
0x09, 0x52, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65,
0x68, 0x61, 0x22, 0x4c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73,
0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65,
0x12, 0x2e, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12,
0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x75, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x6f, 0x75, 0x72,
0x22, 0xee, 0x02, 0x0a, 0x0e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x74,
0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x68, 0x61,
0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x6f,
0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6f, 0x75, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x68, 0x61, 0x22, 0x4c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x44, 0x69,
0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x02, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01,
0x69, 0x74, 0x53, 0x68, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x46,
0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x6f, 0x69, 0x6c, 0x65, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x05,
0x75, 0x72, 0x63, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x61, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0xee, 0x02, 0x0a, 0x0e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75,
0x72, 0x67, 0x65, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61,
0x6d, 0x69, 0x74, 0x53, 0x68, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x2a,
0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x0a, 0x11, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f,
0x61, 0x72, 0x67, 0x65, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x73, 0x68, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x68, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6f,
0x1d, 0x0a, 0x0a, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x07, 0x20, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28,
0x01, 0x28, 0x05, 0x52, 0x09, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x24, 0x09, 0x52, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12,
0x0a, 0x0e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6e, 0x65, 0x77, 0x2a, 0x0a, 0x11, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x72, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x72, 0x67,
0x74, 0x4e, 0x65, 0x77, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x68, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x74,
0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01,
0x20, 0x0a, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x6e, 0x65, 0x77, 0x18, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6c, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x64, 0x4e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x77, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x74, 0x61,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x68, 0x65, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74,
0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x70, 0x63, 0x61, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72,
0x2e, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x68, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x65, 0x77, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6c, 0x69, 0x6e,
0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4e, 0x65, 0x77, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x69, 0x6e,
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6e,
0x0e, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e, 0x64,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x65, 0x77, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6c, 0x69, 0x6e, 0x65,
0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x45, 0x6e, 0x64, 0x4e, 0x65, 0x77, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x66, 0x66, 0x43,
0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x68, 0x75,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x68, 0x61, 0x32, 0x6e, 0x6b, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x96, 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x35, 0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x52, 0x0a, 0x68, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05,
0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x69, 0x6e,
0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65,
0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x72, 0x67,
0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x65, 0x42, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x61, 0x74, 0x65,
0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20,
0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44, 0x69, 0x65, 0x53, 0x68, 0x61, 0x32, 0x96, 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66, 0x53, 0x65, 0x72,
0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x12,
0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x52,
0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0d, 0x44,
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72,
0x12, 0x36, 0x0a, 0x07, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a,
0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74,
0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66,
0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66,
0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74,
0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66,
0x43, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x27, 0x5a,
0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e,
0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72,
0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -823,7 +839,7 @@ func file_diff_proto_rawDescGZIP() []byte {
return file_diff_proto_rawDescData return file_diff_proto_rawDescData
} }
var file_diff_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_diff_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_diff_proto_goTypes = []interface{}{ var file_diff_proto_goTypes = []interface{}{
(*DiffRequest)(nil), // 0: rpc.DiffRequest (*DiffRequest)(nil), // 0: rpc.DiffRequest
(*RawDiffResponse)(nil), // 1: rpc.RawDiffResponse (*RawDiffResponse)(nil), // 1: rpc.RawDiffResponse
@ -835,29 +851,31 @@ var file_diff_proto_goTypes = []interface{}{
(*GetDiffHunkHeadersResponse)(nil), // 7: rpc.GetDiffHunkHeadersResponse (*GetDiffHunkHeadersResponse)(nil), // 7: rpc.GetDiffHunkHeadersResponse
(*DiffCutRequest)(nil), // 8: rpc.DiffCutRequest (*DiffCutRequest)(nil), // 8: rpc.DiffCutRequest
(*DiffCutResponse)(nil), // 9: rpc.DiffCutResponse (*DiffCutResponse)(nil), // 9: rpc.DiffCutResponse
(*ReadRequest)(nil), // 10: rpc.ReadRequest nil, // 10: rpc.DiffFileHeader.ExtensionsEntry
(*ReadRequest)(nil), // 11: rpc.ReadRequest
} }
var file_diff_proto_depIdxs = []int32{ var file_diff_proto_depIdxs = []int32{
10, // 0: rpc.DiffRequest.base:type_name -> rpc.ReadRequest 11, // 0: rpc.DiffRequest.base:type_name -> rpc.ReadRequest
4, // 1: rpc.DiffFileHunkHeaders.file_header:type_name -> rpc.DiffFileHeader 10, // 1: rpc.DiffFileHeader.extensions:type_name -> rpc.DiffFileHeader.ExtensionsEntry
3, // 2: rpc.DiffFileHunkHeaders.hunk_headers:type_name -> rpc.HunkHeader 4, // 2: rpc.DiffFileHunkHeaders.file_header:type_name -> rpc.DiffFileHeader
10, // 3: rpc.GetDiffHunkHeadersRequest.base:type_name -> rpc.ReadRequest 3, // 3: rpc.DiffFileHunkHeaders.hunk_headers:type_name -> rpc.HunkHeader
5, // 4: rpc.GetDiffHunkHeadersResponse.files:type_name -> rpc.DiffFileHunkHeaders 11, // 4: rpc.GetDiffHunkHeadersRequest.base:type_name -> rpc.ReadRequest
10, // 5: rpc.DiffCutRequest.base:type_name -> rpc.ReadRequest 5, // 5: rpc.GetDiffHunkHeadersResponse.files:type_name -> rpc.DiffFileHunkHeaders
3, // 6: rpc.DiffCutResponse.hunk_header:type_name -> rpc.HunkHeader 11, // 6: rpc.DiffCutRequest.base:type_name -> rpc.ReadRequest
0, // 7: rpc.DiffService.RawDiff:input_type -> rpc.DiffRequest 3, // 7: rpc.DiffCutResponse.hunk_header:type_name -> rpc.HunkHeader
0, // 8: rpc.DiffService.DiffShortStat:input_type -> rpc.DiffRequest 0, // 8: rpc.DiffService.RawDiff:input_type -> rpc.DiffRequest
6, // 9: rpc.DiffService.GetDiffHunkHeaders:input_type -> rpc.GetDiffHunkHeadersRequest 0, // 9: rpc.DiffService.DiffShortStat:input_type -> rpc.DiffRequest
8, // 10: rpc.DiffService.DiffCut:input_type -> rpc.DiffCutRequest 6, // 10: rpc.DiffService.GetDiffHunkHeaders:input_type -> rpc.GetDiffHunkHeadersRequest
1, // 11: rpc.DiffService.RawDiff:output_type -> rpc.RawDiffResponse 8, // 11: rpc.DiffService.DiffCut:input_type -> rpc.DiffCutRequest
2, // 12: rpc.DiffService.DiffShortStat:output_type -> rpc.DiffShortStatResponse 1, // 12: rpc.DiffService.RawDiff:output_type -> rpc.RawDiffResponse
7, // 13: rpc.DiffService.GetDiffHunkHeaders:output_type -> rpc.GetDiffHunkHeadersResponse 2, // 13: rpc.DiffService.DiffShortStat:output_type -> rpc.DiffShortStatResponse
9, // 14: rpc.DiffService.DiffCut:output_type -> rpc.DiffCutResponse 7, // 14: rpc.DiffService.GetDiffHunkHeaders:output_type -> rpc.GetDiffHunkHeadersResponse
11, // [11:15] is the sub-list for method output_type 9, // 15: rpc.DiffService.DiffCut:output_type -> rpc.DiffCutResponse
7, // [7:11] is the sub-list for method input_type 12, // [12:16] is the sub-list for method output_type
7, // [7:7] is the sub-list for extension type_name 8, // [8:12] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension extendee 8, // [8:8] is the sub-list for extension type_name
0, // [0:7] is the sub-list for field type_name 8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
} }
func init() { file_diff_proto_init() } func init() { file_diff_proto_init() }
@ -994,7 +1012,7 @@ func file_diff_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_diff_proto_rawDesc, RawDescriptor: file_diff_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 10, NumMessages: 11,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -151,6 +151,7 @@ type ServicePackRequest struct {
// Depending on the service the matching base type has to be passed // Depending on the service the matching base type has to be passed
// //
// Types that are assignable to Base: // Types that are assignable to Base:
//
// *ServicePackRequest_ReadBase // *ServicePackRequest_ReadBase
// *ServicePackRequest_WriteBase // *ServicePackRequest_WriteBase
Base isServicePackRequest_Base `protobuf_oneof:"base"` Base isServicePackRequest_Base `protobuf_oneof:"base"`

View File

@ -247,6 +247,7 @@ type CommitFilesAction struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Payload: // Types that are assignable to Payload:
//
// *CommitFilesAction_Header // *CommitFilesAction_Header
// *CommitFilesAction_Content // *CommitFilesAction_Content
Payload isCommitFilesAction_Payload `protobuf_oneof:"payload"` Payload isCommitFilesAction_Payload `protobuf_oneof:"payload"`
@ -330,6 +331,7 @@ type CommitFilesRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Payload: // Types that are assignable to Payload:
//
// *CommitFilesRequest_Header // *CommitFilesRequest_Header
// *CommitFilesRequest_Action // *CommitFilesRequest_Action
Payload isCommitFilesRequest_Payload `protobuf_oneof:"payload"` Payload isCommitFilesRequest_Payload `protobuf_oneof:"payload"`

View File

@ -130,6 +130,7 @@ type CreateRepositoryRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Data: // Types that are assignable to Data:
//
// *CreateRepositoryRequest_Header // *CreateRepositoryRequest_Header
// *CreateRepositoryRequest_File // *CreateRepositoryRequest_File
Data isCreateRepositoryRequest_Data `protobuf_oneof:"data"` Data isCreateRepositoryRequest_Data `protobuf_oneof:"data"`
@ -949,6 +950,7 @@ type GetBlobResponse struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Data: // Types that are assignable to Data:
//
// *GetBlobResponse_Header // *GetBlobResponse_Header
// *GetBlobResponse_Content // *GetBlobResponse_Content
Data isGetBlobResponse_Data `protobuf_oneof:"data"` Data isGetBlobResponse_Data `protobuf_oneof:"data"`
@ -1556,6 +1558,116 @@ func (*DeleteRepositoryResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{23} return file_repo_proto_rawDescGZIP(), []int{23}
} }
type MergeBaseRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Base *ReadRequest `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
Ref1 string `protobuf:"bytes,2,opt,name=ref1,proto3" json:"ref1,omitempty"`
Ref2 string `protobuf:"bytes,3,opt,name=ref2,proto3" json:"ref2,omitempty"`
}
func (x *MergeBaseRequest) Reset() {
*x = MergeBaseRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MergeBaseRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MergeBaseRequest) ProtoMessage() {}
func (x *MergeBaseRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[24]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MergeBaseRequest.ProtoReflect.Descriptor instead.
func (*MergeBaseRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{24}
}
func (x *MergeBaseRequest) GetBase() *ReadRequest {
if x != nil {
return x.Base
}
return nil
}
func (x *MergeBaseRequest) GetRef1() string {
if x != nil {
return x.Ref1
}
return ""
}
func (x *MergeBaseRequest) GetRef2() string {
if x != nil {
return x.Ref2
}
return ""
}
type MergeBaseResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MergeBaseSha string `protobuf:"bytes,1,opt,name=merge_base_sha,json=mergeBaseSha,proto3" json:"merge_base_sha,omitempty"`
}
func (x *MergeBaseResponse) Reset() {
*x = MergeBaseResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MergeBaseResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MergeBaseResponse) ProtoMessage() {}
func (x *MergeBaseResponse) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MergeBaseResponse.ProtoReflect.Descriptor instead.
func (*MergeBaseResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{25}
}
func (x *MergeBaseResponse) GetMergeBaseSha() string {
if x != nil {
return x.MergeBaseSha
}
return ""
}
var File_repo_proto protoreflect.FileDescriptor var File_repo_proto protoreflect.FileDescriptor
var file_repo_proto_rawDesc = []byte{ var file_repo_proto_rawDesc = []byte{
@ -1711,65 +1823,79 @@ var file_repo_proto_rawDesc = []byte{
0x70, 0x63, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x70, 0x63, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52,
0x04, 0x62, 0x61, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x2a, 0x52, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x60, 0x0a, 0x10, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65,
0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20,
0x65, 0x54, 0x72, 0x65, 0x65, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65,
0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x6c, 0x6f, 0x62, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72,
0x12, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x6d, 0x65, 0x66, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x65, 0x66, 0x31, 0x12,
0x6d, 0x69, 0x74, 0x10, 0x02, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x12, 0x0a, 0x04, 0x72, 0x65, 0x66, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72,
0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x65, 0x66, 0x32, 0x22, 0x39, 0x0a, 0x11, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65,
0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x65, 0x72, 0x67,
0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x53, 0x79, 0x6d, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x69, 0x6e, 0x6b, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x52, 0x0c, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x2a, 0x52,
0x65, 0x4d, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14,
0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x54, 0x72, 0x65, 0x65, 0x10, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x54, 0x72,
0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x65, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65,
0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x10, 0x04, 0x32, 0x9d, 0x05, 0x0a, 0x11, 0x52, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x6c, 0x6f, 0x62, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x72,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x51, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x10, 0x02, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d,
0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d,
0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x72, 0x65,
0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x53, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f,
0x28, 0x01, 0x12, 0x40, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65,
0x65, 0x12, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x54, 0x72, 0x65, 0x65, 0x10, 0x03, 0x12, 0x16,
0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x43, 0x6f,
0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6d, 0x6d, 0x69, 0x74, 0x10, 0x04, 0x32, 0xd9, 0x05, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x73,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x10,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79,
0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70,
0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x43, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73,
0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x18, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12,
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x40, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65,
0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65,
0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x13, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64,
0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x65, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65,
0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0b, 0x4c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e,
0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0c, 0x47,
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x18, 0x2e, 0x72, 0x70,
0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65,
0x3a, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x15, 0x2e, 0x72, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53,
0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x12, 0x36, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x13, 0x2e, 0x72, 0x70,
0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x14, 0x47, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65,
0x63, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74,
0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x3a, 0x0a, 0x09,
0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x15, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43,
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x12, 0x20, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x72, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d,
0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73,
0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79,
0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65,
0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42,
0x61, 0x73, 0x65, 0x12, 0x15, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42,
0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63,
0x2e, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73,
0x2f, 0x67, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
@ -1785,7 +1911,7 @@ func file_repo_proto_rawDescGZIP() []byte {
} }
var file_repo_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_repo_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_repo_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_repo_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_repo_proto_goTypes = []interface{}{ var file_repo_proto_goTypes = []interface{}{
(TreeNodeType)(0), // 0: rpc.TreeNodeType (TreeNodeType)(0), // 0: rpc.TreeNodeType
(TreeNodeMode)(0), // 1: rpc.TreeNodeMode (TreeNodeMode)(0), // 1: rpc.TreeNodeMode
@ -1813,61 +1939,66 @@ var file_repo_proto_goTypes = []interface{}{
(*CommitDivergence)(nil), // 23: rpc.CommitDivergence (*CommitDivergence)(nil), // 23: rpc.CommitDivergence
(*DeleteRepositoryRequest)(nil), // 24: rpc.DeleteRepositoryRequest (*DeleteRepositoryRequest)(nil), // 24: rpc.DeleteRepositoryRequest
(*DeleteRepositoryResponse)(nil), // 25: rpc.DeleteRepositoryResponse (*DeleteRepositoryResponse)(nil), // 25: rpc.DeleteRepositoryResponse
(*FileUpload)(nil), // 26: rpc.FileUpload (*MergeBaseRequest)(nil), // 26: rpc.MergeBaseRequest
(*WriteRequest)(nil), // 27: rpc.WriteRequest (*MergeBaseResponse)(nil), // 27: rpc.MergeBaseResponse
(*Identity)(nil), // 28: rpc.Identity (*FileUpload)(nil), // 28: rpc.FileUpload
(*ReadRequest)(nil), // 29: rpc.ReadRequest (*WriteRequest)(nil), // 29: rpc.WriteRequest
(*Commit)(nil), // 30: rpc.Commit (*Identity)(nil), // 30: rpc.Identity
(*ReadRequest)(nil), // 31: rpc.ReadRequest
(*Commit)(nil), // 32: rpc.Commit
} }
var file_repo_proto_depIdxs = []int32{ var file_repo_proto_depIdxs = []int32{
3, // 0: rpc.CreateRepositoryRequest.header:type_name -> rpc.CreateRepositoryRequestHeader 3, // 0: rpc.CreateRepositoryRequest.header:type_name -> rpc.CreateRepositoryRequestHeader
26, // 1: rpc.CreateRepositoryRequest.file:type_name -> rpc.FileUpload 28, // 1: rpc.CreateRepositoryRequest.file:type_name -> rpc.FileUpload
27, // 2: rpc.CreateRepositoryRequestHeader.base:type_name -> rpc.WriteRequest 29, // 2: rpc.CreateRepositoryRequestHeader.base:type_name -> rpc.WriteRequest
28, // 3: rpc.CreateRepositoryRequestHeader.author:type_name -> rpc.Identity 30, // 3: rpc.CreateRepositoryRequestHeader.author:type_name -> rpc.Identity
28, // 4: rpc.CreateRepositoryRequestHeader.committer:type_name -> rpc.Identity 30, // 4: rpc.CreateRepositoryRequestHeader.committer:type_name -> rpc.Identity
29, // 5: rpc.GetTreeNodeRequest.base:type_name -> rpc.ReadRequest 31, // 5: rpc.GetTreeNodeRequest.base:type_name -> rpc.ReadRequest
9, // 6: rpc.GetTreeNodeResponse.node:type_name -> rpc.TreeNode 9, // 6: rpc.GetTreeNodeResponse.node:type_name -> rpc.TreeNode
30, // 7: rpc.GetTreeNodeResponse.commit:type_name -> rpc.Commit 32, // 7: rpc.GetTreeNodeResponse.commit:type_name -> rpc.Commit
29, // 8: rpc.ListTreeNodesRequest.base:type_name -> rpc.ReadRequest 31, // 8: rpc.ListTreeNodesRequest.base:type_name -> rpc.ReadRequest
9, // 9: rpc.ListTreeNodesResponse.node:type_name -> rpc.TreeNode 9, // 9: rpc.ListTreeNodesResponse.node:type_name -> rpc.TreeNode
30, // 10: rpc.ListTreeNodesResponse.commit:type_name -> rpc.Commit 32, // 10: rpc.ListTreeNodesResponse.commit:type_name -> rpc.Commit
0, // 11: rpc.TreeNode.type:type_name -> rpc.TreeNodeType 0, // 11: rpc.TreeNode.type:type_name -> rpc.TreeNodeType
1, // 12: rpc.TreeNode.mode:type_name -> rpc.TreeNodeMode 1, // 12: rpc.TreeNode.mode:type_name -> rpc.TreeNodeMode
29, // 13: rpc.GetCommitRequest.base:type_name -> rpc.ReadRequest 31, // 13: rpc.GetCommitRequest.base:type_name -> rpc.ReadRequest
30, // 14: rpc.GetCommitResponse.commit:type_name -> rpc.Commit 32, // 14: rpc.GetCommitResponse.commit:type_name -> rpc.Commit
29, // 15: rpc.ListCommitsRequest.base:type_name -> rpc.ReadRequest 31, // 15: rpc.ListCommitsRequest.base:type_name -> rpc.ReadRequest
30, // 16: rpc.ListCommitsResponse.commit:type_name -> rpc.Commit 32, // 16: rpc.ListCommitsResponse.commit:type_name -> rpc.Commit
29, // 17: rpc.GetBlobRequest.base:type_name -> rpc.ReadRequest 31, // 17: rpc.GetBlobRequest.base:type_name -> rpc.ReadRequest
16, // 18: rpc.GetBlobResponse.header:type_name -> rpc.GetBlobResponseHeader 16, // 18: rpc.GetBlobResponse.header:type_name -> rpc.GetBlobResponseHeader
29, // 19: rpc.GetSubmoduleRequest.base:type_name -> rpc.ReadRequest 31, // 19: rpc.GetSubmoduleRequest.base:type_name -> rpc.ReadRequest
19, // 20: rpc.GetSubmoduleResponse.submodule:type_name -> rpc.Submodule 19, // 20: rpc.GetSubmoduleResponse.submodule:type_name -> rpc.Submodule
29, // 21: rpc.GetCommitDivergencesRequest.base:type_name -> rpc.ReadRequest 31, // 21: rpc.GetCommitDivergencesRequest.base:type_name -> rpc.ReadRequest
21, // 22: rpc.GetCommitDivergencesRequest.requests:type_name -> rpc.CommitDivergenceRequest 21, // 22: rpc.GetCommitDivergencesRequest.requests:type_name -> rpc.CommitDivergenceRequest
23, // 23: rpc.GetCommitDivergencesResponse.divergences:type_name -> rpc.CommitDivergence 23, // 23: rpc.GetCommitDivergencesResponse.divergences:type_name -> rpc.CommitDivergence
27, // 24: rpc.DeleteRepositoryRequest.base:type_name -> rpc.WriteRequest 29, // 24: rpc.DeleteRepositoryRequest.base:type_name -> rpc.WriteRequest
2, // 25: rpc.RepositoryService.CreateRepository:input_type -> rpc.CreateRepositoryRequest 31, // 25: rpc.MergeBaseRequest.base:type_name -> rpc.ReadRequest
5, // 26: rpc.RepositoryService.GetTreeNode:input_type -> rpc.GetTreeNodeRequest 2, // 26: rpc.RepositoryService.CreateRepository:input_type -> rpc.CreateRepositoryRequest
7, // 27: rpc.RepositoryService.ListTreeNodes:input_type -> rpc.ListTreeNodesRequest 5, // 27: rpc.RepositoryService.GetTreeNode:input_type -> rpc.GetTreeNodeRequest
17, // 28: rpc.RepositoryService.GetSubmodule:input_type -> rpc.GetSubmoduleRequest 7, // 28: rpc.RepositoryService.ListTreeNodes:input_type -> rpc.ListTreeNodesRequest
14, // 29: rpc.RepositoryService.GetBlob:input_type -> rpc.GetBlobRequest 17, // 29: rpc.RepositoryService.GetSubmodule:input_type -> rpc.GetSubmoduleRequest
12, // 30: rpc.RepositoryService.ListCommits:input_type -> rpc.ListCommitsRequest 14, // 30: rpc.RepositoryService.GetBlob:input_type -> rpc.GetBlobRequest
10, // 31: rpc.RepositoryService.GetCommit:input_type -> rpc.GetCommitRequest 12, // 31: rpc.RepositoryService.ListCommits:input_type -> rpc.ListCommitsRequest
20, // 32: rpc.RepositoryService.GetCommitDivergences:input_type -> rpc.GetCommitDivergencesRequest 10, // 32: rpc.RepositoryService.GetCommit:input_type -> rpc.GetCommitRequest
24, // 33: rpc.RepositoryService.DeleteRepository:input_type -> rpc.DeleteRepositoryRequest 20, // 33: rpc.RepositoryService.GetCommitDivergences:input_type -> rpc.GetCommitDivergencesRequest
4, // 34: rpc.RepositoryService.CreateRepository:output_type -> rpc.CreateRepositoryResponse 24, // 34: rpc.RepositoryService.DeleteRepository:input_type -> rpc.DeleteRepositoryRequest
6, // 35: rpc.RepositoryService.GetTreeNode:output_type -> rpc.GetTreeNodeResponse 26, // 35: rpc.RepositoryService.MergeBase:input_type -> rpc.MergeBaseRequest
8, // 36: rpc.RepositoryService.ListTreeNodes:output_type -> rpc.ListTreeNodesResponse 4, // 36: rpc.RepositoryService.CreateRepository:output_type -> rpc.CreateRepositoryResponse
18, // 37: rpc.RepositoryService.GetSubmodule:output_type -> rpc.GetSubmoduleResponse 6, // 37: rpc.RepositoryService.GetTreeNode:output_type -> rpc.GetTreeNodeResponse
15, // 38: rpc.RepositoryService.GetBlob:output_type -> rpc.GetBlobResponse 8, // 38: rpc.RepositoryService.ListTreeNodes:output_type -> rpc.ListTreeNodesResponse
13, // 39: rpc.RepositoryService.ListCommits:output_type -> rpc.ListCommitsResponse 18, // 39: rpc.RepositoryService.GetSubmodule:output_type -> rpc.GetSubmoduleResponse
11, // 40: rpc.RepositoryService.GetCommit:output_type -> rpc.GetCommitResponse 15, // 40: rpc.RepositoryService.GetBlob:output_type -> rpc.GetBlobResponse
22, // 41: rpc.RepositoryService.GetCommitDivergences:output_type -> rpc.GetCommitDivergencesResponse 13, // 41: rpc.RepositoryService.ListCommits:output_type -> rpc.ListCommitsResponse
25, // 42: rpc.RepositoryService.DeleteRepository:output_type -> rpc.DeleteRepositoryResponse 11, // 42: rpc.RepositoryService.GetCommit:output_type -> rpc.GetCommitResponse
34, // [34:43] is the sub-list for method output_type 22, // 43: rpc.RepositoryService.GetCommitDivergences:output_type -> rpc.GetCommitDivergencesResponse
25, // [25:34] is the sub-list for method input_type 25, // 44: rpc.RepositoryService.DeleteRepository:output_type -> rpc.DeleteRepositoryResponse
25, // [25:25] is the sub-list for extension type_name 27, // 45: rpc.RepositoryService.MergeBase:output_type -> rpc.MergeBaseResponse
25, // [25:25] is the sub-list for extension extendee 36, // [36:46] is the sub-list for method output_type
0, // [0:25] is the sub-list for field type_name 26, // [26:36] is the sub-list for method input_type
26, // [26:26] is the sub-list for extension type_name
26, // [26:26] is the sub-list for extension extendee
0, // [0:26] is the sub-list for field type_name
} }
func init() { file_repo_proto_init() } func init() { file_repo_proto_init() }
@ -2165,6 +2296,30 @@ func file_repo_proto_init() {
return nil return nil
} }
} }
file_repo_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MergeBaseRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_repo_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MergeBaseResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
file_repo_proto_msgTypes[0].OneofWrappers = []interface{}{ file_repo_proto_msgTypes[0].OneofWrappers = []interface{}{
(*CreateRepositoryRequest_Header)(nil), (*CreateRepositoryRequest_Header)(nil),
@ -2180,7 +2335,7 @@ func file_repo_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_repo_proto_rawDesc, RawDescriptor: file_repo_proto_rawDesc,
NumEnums: 2, NumEnums: 2,
NumMessages: 24, NumMessages: 26,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -31,6 +31,7 @@ type RepositoryServiceClient interface {
GetCommit(ctx context.Context, in *GetCommitRequest, opts ...grpc.CallOption) (*GetCommitResponse, error) GetCommit(ctx context.Context, in *GetCommitRequest, opts ...grpc.CallOption) (*GetCommitResponse, error)
GetCommitDivergences(ctx context.Context, in *GetCommitDivergencesRequest, opts ...grpc.CallOption) (*GetCommitDivergencesResponse, error) GetCommitDivergences(ctx context.Context, in *GetCommitDivergencesRequest, opts ...grpc.CallOption) (*GetCommitDivergencesResponse, error)
DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error) DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error)
MergeBase(ctx context.Context, in *MergeBaseRequest, opts ...grpc.CallOption) (*MergeBaseResponse, error)
} }
type repositoryServiceClient struct { type repositoryServiceClient struct {
@ -216,6 +217,15 @@ func (c *repositoryServiceClient) DeleteRepository(ctx context.Context, in *Dele
return out, nil return out, nil
} }
func (c *repositoryServiceClient) MergeBase(ctx context.Context, in *MergeBaseRequest, opts ...grpc.CallOption) (*MergeBaseResponse, error) {
out := new(MergeBaseResponse)
err := c.cc.Invoke(ctx, "/rpc.RepositoryService/MergeBase", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// RepositoryServiceServer is the server API for RepositoryService service. // RepositoryServiceServer is the server API for RepositoryService service.
// All implementations must embed UnimplementedRepositoryServiceServer // All implementations must embed UnimplementedRepositoryServiceServer
// for forward compatibility // for forward compatibility
@ -229,6 +239,7 @@ type RepositoryServiceServer interface {
GetCommit(context.Context, *GetCommitRequest) (*GetCommitResponse, error) GetCommit(context.Context, *GetCommitRequest) (*GetCommitResponse, error)
GetCommitDivergences(context.Context, *GetCommitDivergencesRequest) (*GetCommitDivergencesResponse, error) GetCommitDivergences(context.Context, *GetCommitDivergencesRequest) (*GetCommitDivergencesResponse, error)
DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error)
MergeBase(context.Context, *MergeBaseRequest) (*MergeBaseResponse, error)
mustEmbedUnimplementedRepositoryServiceServer() mustEmbedUnimplementedRepositoryServiceServer()
} }
@ -263,6 +274,9 @@ func (UnimplementedRepositoryServiceServer) GetCommitDivergences(context.Context
func (UnimplementedRepositoryServiceServer) DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) { func (UnimplementedRepositoryServiceServer) DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteRepository not implemented") return nil, status.Errorf(codes.Unimplemented, "method DeleteRepository not implemented")
} }
func (UnimplementedRepositoryServiceServer) MergeBase(context.Context, *MergeBaseRequest) (*MergeBaseResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MergeBase not implemented")
}
func (UnimplementedRepositoryServiceServer) mustEmbedUnimplementedRepositoryServiceServer() {} func (UnimplementedRepositoryServiceServer) mustEmbedUnimplementedRepositoryServiceServer() {}
// UnsafeRepositoryServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeRepositoryServiceServer may be embedded to opt out of forward compatibility for this service.
@ -455,6 +469,24 @@ func _RepositoryService_DeleteRepository_Handler(srv interface{}, ctx context.Co
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _RepositoryService_MergeBase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MergeBaseRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RepositoryServiceServer).MergeBase(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.RepositoryService/MergeBase",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RepositoryServiceServer).MergeBase(ctx, req.(*MergeBaseRequest))
}
return interceptor(ctx, in, info, handler)
}
// RepositoryService_ServiceDesc is the grpc.ServiceDesc for RepositoryService service. // RepositoryService_ServiceDesc is the grpc.ServiceDesc for RepositoryService service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -482,6 +514,10 @@ var RepositoryService_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteRepository", MethodName: "DeleteRepository",
Handler: _RepositoryService_DeleteRepository_Handler, Handler: _RepositoryService_DeleteRepository_Handler,
}, },
{
MethodName: "MergeBase",
Handler: _RepositoryService_MergeBase_Handler,
},
}, },
Streams: []grpc.StreamDesc{ Streams: []grpc.StreamDesc{
{ {

View File

@ -298,6 +298,7 @@ type FileUpload struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Data: // Types that are assignable to Data:
//
// *FileUpload_Header // *FileUpload_Header
// *FileUpload_Chunk // *FileUpload_Chunk
Data isFileUpload_Data `protobuf_oneof:"data"` Data isFileUpload_Data `protobuf_oneof:"data"`

View File

@ -129,7 +129,7 @@ func (c *Controller) CommentCreate(
// Migrate the comment if necessary... Note: we still need to return the code comment as is. // Migrate the comment if necessary... Note: we still need to return the code comment as is.
needsNewLineMigrate := in.SourceCommitSHA != cut.LatestSourceSHA needsNewLineMigrate := in.SourceCommitSHA != cut.LatestSourceSHA
needsOldLineMigrate := pr.MergeBaseSHA != nil && *pr.MergeBaseSHA != cut.MergeBaseSHA needsOldLineMigrate := pr.MergeBaseSHA != cut.MergeBaseSHA
if err == nil && (needsNewLineMigrate || needsOldLineMigrate) { if err == nil && (needsNewLineMigrate || needsOldLineMigrate) {
comments := []*types.CodeComment{act.AsCodeComment()} comments := []*types.CodeComment{act.AsCodeComment()}

View File

@ -133,7 +133,7 @@ func (c *Controller) Merge(
// update all Merge specific information (might be empty if previous merge check failed) // update all Merge specific information (might be empty if previous merge check failed)
pr.MergeCheckStatus = enum.MergeCheckStatusMergeable pr.MergeCheckStatus = enum.MergeCheckStatusMergeable
pr.MergeTargetSHA = &mergeOutput.BaseSHA pr.MergeTargetSHA = &mergeOutput.BaseSHA
pr.MergeBaseSHA = &mergeOutput.MergeBaseSHA pr.MergeBaseSHA = mergeOutput.MergeBaseSHA
pr.MergeSHA = &mergeOutput.MergeSHA pr.MergeSHA = &mergeOutput.MergeSHA
pr.MergeConflicts = nil pr.MergeConflicts = nil

View File

@ -33,14 +33,8 @@ func (c *Controller) Commits(
return nil, fmt.Errorf("failed to get pull request by number: %w", err) return nil, fmt.Errorf("failed to get pull request by number: %w", err)
} }
gitRef := pr.SourceBranch gitRef := pr.SourceSHA
if pr.SourceSHA != "" { afterRef := pr.MergeBaseSHA
gitRef = pr.SourceSHA
}
afterRef := pr.TargetBranch
if pr.MergeBaseSHA != nil {
afterRef = *pr.MergeBaseSHA
}
rpcOut, err := c.gitRPCClient.ListCommits(ctx, &gitrpc.ListCommitsParams{ rpcOut, err := c.gitRPCClient.ListCommits(ctx, &gitrpc.ListCommitsParams{
ReadParams: gitrpc.CreateRPCReadParams(repo), ReadParams: gitrpc.CreateRPCReadParams(repo),

View File

@ -10,6 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/harness/gitness/gitrpc"
"github.com/harness/gitness/internal/api/usererror" "github.com/harness/gitness/internal/api/usererror"
"github.com/harness/gitness/internal/auth" "github.com/harness/gitness/internal/auth"
pullreqevents "github.com/harness/gitness/internal/events/pullreq" pullreqevents "github.com/harness/gitness/internal/events/pullreq"
@ -71,6 +72,17 @@ func (c *Controller) Create(
return nil, err return nil, err
} }
mergeBaseResult, err := c.gitRPCClient.MergeBase(ctx, gitrpc.MergeBaseParams{
ReadParams: gitrpc.ReadParams{RepoUID: sourceRepo.GitUID},
Ref1: in.SourceBranch,
Ref2: in.TargetBranch,
})
if err != nil {
return nil, fmt.Errorf("failed to find merge base: %w", err)
}
mergeBaseSHA := mergeBaseResult.MergeBaseSHA
targetRepo, err = c.repoStore.UpdateOptLock(ctx, targetRepo, func(repo *types.Repository) error { targetRepo, err = c.repoStore.UpdateOptLock(ctx, targetRepo, func(repo *types.Repository) error {
repo.PullReqSeq++ repo.PullReqSeq++
return nil return nil
@ -79,7 +91,7 @@ func (c *Controller) Create(
return nil, fmt.Errorf("failed to aquire PullReqSeq number: %w", err) return nil, fmt.Errorf("failed to aquire PullReqSeq number: %w", err)
} }
pr := newPullReq(session, targetRepo.PullReqSeq, sourceRepo, targetRepo, in, sourceSHA) pr := newPullReq(session, targetRepo.PullReqSeq, sourceRepo, targetRepo, in, sourceSHA, mergeBaseSHA)
err = c.pullreqStore.Create(ctx, pr) err = c.pullreqStore.Create(ctx, pr)
if err != nil { if err != nil {
@ -103,7 +115,7 @@ func newPullReq(
sourceRepo *types.Repository, sourceRepo *types.Repository,
targetRepo *types.Repository, targetRepo *types.Repository,
in *CreateInput, in *CreateInput,
sourceSHA string, sourceSHA, mergeBaseSHA string,
) *types.PullReq { ) *types.PullReq {
now := time.Now().UnixMilli() now := time.Now().UnixMilli()
return &types.PullReq{ return &types.PullReq{
@ -128,6 +140,7 @@ func newPullReq(
Merged: nil, Merged: nil,
MergeCheckStatus: enum.MergeCheckStatusUnchecked, MergeCheckStatus: enum.MergeCheckStatusUnchecked,
MergeMethod: nil, MergeMethod: nil,
MergeBaseSHA: mergeBaseSHA,
Author: *session.Principal.ToPrincipalInfo(), Author: *session.Principal.ToPrincipalInfo(),
Merger: nil, Merger: nil,
} }

View File

@ -32,14 +32,8 @@ func (c *Controller) RawDiff(
return fmt.Errorf("failed to get pull request by number: %w", err) return fmt.Errorf("failed to get pull request by number: %w", err)
} }
headRef := pr.SourceBranch headRef := pr.SourceSHA
if pr.SourceSHA != "" { baseRef := pr.MergeBaseSHA
headRef = pr.SourceSHA
}
baseRef := pr.TargetBranch
if pr.MergeBaseSHA != nil {
baseRef = *pr.MergeBaseSHA
}
return c.gitRPCClient.RawDiff(ctx, &gitrpc.DiffParams{ return c.gitRPCClient.RawDiff(ctx, &gitrpc.DiffParams{
ReadParams: gitrpc.CreateRPCReadParams(repo), ReadParams: gitrpc.CreateRPCReadParams(repo),

View File

@ -36,14 +36,8 @@ func (c *Controller) Find(
return nil, err return nil, err
} }
headRef := pr.SourceBranch headRef := pr.SourceSHA
if pr.SourceSHA != "" { baseRef := pr.MergeBaseSHA
headRef = pr.SourceSHA
}
baseRef := pr.TargetBranch
if pr.MergeBaseSHA != nil {
baseRef = *pr.MergeBaseSHA
}
output, err := c.gitRPCClient.DiffStats(ctx, &gitrpc.DiffParams{ output, err := c.gitRPCClient.DiffStats(ctx, &gitrpc.DiffParams{
ReadParams: gitrpc.CreateRPCReadParams(repo), ReadParams: gitrpc.CreateRPCReadParams(repo),

View File

@ -16,9 +16,11 @@ const BranchUpdatedEvent events.EventType = "branch-updated"
type BranchUpdatedPayload struct { type BranchUpdatedPayload struct {
Base Base
OldSHA string `json:"old_sha"` OldSHA string `json:"old_sha"`
NewSHA string `json:"new_sha"` NewSHA string `json:"new_sha"`
Forced bool `json:"forced"` OldMergeBaseSHA string `json:"old_merge_base_sha"`
NewMergeBaseSHA string `json:"new_merge_base_sha"`
Forced bool `json:"forced"`
} }
func (r *Reporter) BranchUpdated(ctx context.Context, payload *BranchUpdatedPayload) { func (r *Reporter) BranchUpdated(ctx context.Context, payload *BranchUpdatedPayload) {

View File

@ -8,6 +8,7 @@ import (
"context" "context"
"github.com/harness/gitness/gitrpc" "github.com/harness/gitness/gitrpc"
gitrpcenum "github.com/harness/gitness/gitrpc/enum"
"github.com/harness/gitness/types" "github.com/harness/gitness/types"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@ -75,7 +76,7 @@ func (migrator *Migrator) MigrateOld(
) )
} }
//nolint:gocognit // refactor if needed //nolint:gocognit,funlen // refactor if needed
func (migrator *Migrator) migrate( func (migrator *Migrator) migrate(
ctx context.Context, ctx context.Context,
repoGitUID string, repoGitUID string,
@ -136,7 +137,15 @@ func (migrator *Migrator) migrate(
} }
// Handle file delete // Handle file delete
if len(file.HunkHeaders) == 1 && file.HunkHeaders[0].NewLine == 0 && file.HunkHeaders[0].NewSpan == 0 { if _, isDeleted := file.FileHeader.Extensions[gitrpcenum.DiffExtHeaderDeletedFileMode]; isDeleted {
for _, codeComment := range codeComments {
codeComment.Outdated = true
}
continue
}
// Handle new files - shouldn't happen because code comments should exist for a non-existing file.
if _, isAdded := file.FileHeader.Extensions[gitrpcenum.DiffExtHeaderNewFileMode]; isAdded {
for _, codeComment := range codeComments { for _, codeComment := range codeComments {
codeComment.Outdated = true codeComment.Outdated = true
} }

View File

@ -10,6 +10,7 @@ import (
"strings" "strings"
"github.com/harness/gitness/events" "github.com/harness/gitness/events"
"github.com/harness/gitness/gitrpc"
gitevents "github.com/harness/gitness/internal/events/git" gitevents "github.com/harness/gitness/internal/events/git"
pullreqevents "github.com/harness/gitness/internal/events/pullreq" pullreqevents "github.com/harness/gitness/internal/events/pullreq"
"github.com/harness/gitness/types" "github.com/harness/gitness/types"
@ -23,8 +24,33 @@ import (
func (s *Service) triggerPREventOnBranchUpdate(ctx context.Context, func (s *Service) triggerPREventOnBranchUpdate(ctx context.Context,
event *events.Event[*gitevents.BranchUpdatedPayload], event *events.Event[*gitevents.BranchUpdatedPayload],
) error { ) error {
// TODO: This function is currently executed directly on branch update event.
// TODO: But it should be executed after the PR's head ref has been updated.
// TODO: This is to make sure the commit exists on the target repository for forked repositories.
s.forEveryOpenPR(ctx, event.Payload.RepoID, event.Payload.Ref, func(pr *types.PullReq) error { s.forEveryOpenPR(ctx, event.Payload.RepoID, event.Payload.Ref, func(pr *types.PullReq) error {
pr, err := s.pullreqStore.UpdateOptLock(ctx, pr, func(pr *types.PullReq) error { // First check if the merge base has changed
targetRepoGit, err := s.repoGitInfoCache.Get(ctx, pr.TargetRepoID)
if err != nil {
return fmt.Errorf("failed to get repo git info: %w", err)
}
mergeBaseInfo, err := s.gitRPCClient.MergeBase(ctx, gitrpc.MergeBaseParams{
ReadParams: gitrpc.ReadParams{RepoUID: targetRepoGit.GitUID},
Ref1: event.Payload.NewSHA,
Ref2: pr.TargetBranch,
})
if err != nil {
return fmt.Errorf("failed to get merge base after branch update to=%s for PR=%d: %w",
event.Payload.NewSHA, pr.Number, err)
}
oldMergeBase := pr.MergeBaseSHA
newMergeBase := mergeBaseInfo.MergeBaseSHA
// Update the database with the latest source commit SHA and the merge base SHA.
pr, err = s.pullreqStore.UpdateOptLock(ctx, pr, func(pr *types.PullReq) error {
pr.ActivitySeq++ pr.ActivitySeq++
if pr.SourceSHA != event.Payload.OldSHA { if pr.SourceSHA != event.Payload.OldSHA {
return fmt.Errorf( return fmt.Errorf(
@ -33,6 +59,7 @@ func (s *Service) triggerPREventOnBranchUpdate(ctx context.Context,
} }
pr.SourceSHA = event.Payload.NewSHA pr.SourceSHA = event.Payload.NewSHA
pr.MergeBaseSHA = newMergeBase
// reset merge-check fields for new run // reset merge-check fields for new run
pr.MergeCheckStatus = enum.MergeCheckStatusUnchecked pr.MergeCheckStatus = enum.MergeCheckStatusUnchecked
@ -63,9 +90,11 @@ func (s *Service) triggerPREventOnBranchUpdate(ctx context.Context,
PrincipalID: event.Payload.PrincipalID, PrincipalID: event.Payload.PrincipalID,
Number: pr.Number, Number: pr.Number,
}, },
OldSHA: event.Payload.OldSHA, OldSHA: event.Payload.OldSHA,
NewSHA: event.Payload.NewSHA, NewSHA: event.Payload.NewSHA,
Forced: event.Payload.Forced, OldMergeBaseSHA: oldMergeBase,
NewMergeBaseSHA: newMergeBase,
Forced: event.Payload.Forced,
}) })
return nil return nil
}) })

View File

@ -11,27 +11,35 @@ import (
"github.com/harness/gitness/events" "github.com/harness/gitness/events"
pullreqevents "github.com/harness/gitness/internal/events/pullreq" pullreqevents "github.com/harness/gitness/internal/events/pullreq"
"github.com/harness/gitness/types" "github.com/harness/gitness/types"
"github.com/rs/zerolog/log"
) )
func (s *Service) updateCodeCommentsOnBranchUpdate(ctx context.Context, func (s *Service) updateCodeCommentsOnBranchUpdate(ctx context.Context,
event *events.Event[*pullreqevents.BranchUpdatedPayload], event *events.Event[*pullreqevents.BranchUpdatedPayload],
) error { ) error {
oldSourceSHA := event.Payload.OldSHA // NOTE: we're ignoring the old value and instead try to update all repoGit, err := s.repoGitInfoCache.Get(ctx, event.Payload.TargetRepoID)
newSourceSHA := event.Payload.NewSHA
log.Ctx(ctx).Debug().
Str("oldSHA", oldSourceSHA).
Str("newSHA", newSourceSHA).
Msgf("code comment update after source branch update")
repoGit, err := s.repoGitInfoCache.Get(ctx, event.Payload.SourceRepoID)
if err != nil { if err != nil {
return fmt.Errorf("failed to get repo git info: %w", err) return fmt.Errorf("failed to get repo git info: %w", err)
} }
codeComments, err := s.codeCommentView.ListNotAtSourceSHA(ctx, event.Payload.PullReqID, newSourceSHA) var codeComments []*types.CodeComment
newMergeBaseSHA := event.Payload.NewMergeBaseSHA
codeComments, err = s.codeCommentView.ListNotAtMergeBaseSHA(ctx, event.Payload.PullReqID, newMergeBaseSHA)
if err != nil {
return fmt.Errorf("failed to get list of code comments for update after merge base update: %w", err)
}
s.codeCommentMigrator.MigrateOld(ctx, repoGit.GitUID, newMergeBaseSHA, codeComments)
err = s.codeCommentView.UpdateAll(ctx, codeComments)
if err != nil {
return fmt.Errorf("failed to update code comments after merge base update: %w", err)
}
newSourceSHA := event.Payload.NewSHA
codeComments, err = s.codeCommentView.ListNotAtSourceSHA(ctx, event.Payload.PullReqID, newSourceSHA)
if err != nil { if err != nil {
return fmt.Errorf("failed to get list of code comments for update after source branch update: %w", err) return fmt.Errorf("failed to get list of code comments for update after source branch update: %w", err)
} }
@ -45,28 +53,3 @@ func (s *Service) updateCodeCommentsOnBranchUpdate(ctx context.Context,
return nil return nil
} }
func (s *Service) updateCodeCommentsOnMergeBaseUpdate(ctx context.Context,
pr *types.PullReq,
gitUID string,
oldMergeBaseSHA, newMergeBaseSHA string,
) error {
log.Ctx(ctx).Debug().
Str("oldSHA", oldMergeBaseSHA).
Str("newSHA", newMergeBaseSHA).
Msgf("code comment update after merge base update")
codeComments, err := s.codeCommentView.ListNotAtMergeBaseSHA(ctx, pr.ID, newMergeBaseSHA)
if err != nil {
return fmt.Errorf("failed to get list of code comments for update after merge base update: %w", err)
}
s.codeCommentMigrator.MigrateOld(ctx, gitUID, newMergeBaseSHA, codeComments)
err = s.codeCommentView.UpdateAll(ctx, codeComments)
if err != nil {
return fmt.Errorf("failed to update code comments after merge base update: %w", err)
}
return nil
}

View File

@ -122,7 +122,7 @@ func (s *Service) deleteMergeRef(ctx context.Context, principalID int64, repoID
return nil return nil
} }
//nolint:funlen,gocognit // refactor if required. //nolint:funlen // refactor if required.
func (s *Service) updateMergeData( func (s *Service) updateMergeData(
ctx context.Context, ctx context.Context,
principalID int64, principalID int64,
@ -131,6 +131,10 @@ func (s *Service) updateMergeData(
oldSHA string, oldSHA string,
newSHA string, newSHA string,
) error { ) error {
// TODO: Merge check should not update the merge base.
// TODO: Instead it should accept it as an argument and fail if it doesn't match.
// Then is would not longer be necessary to cancel already active mergeability checks.
pr, err := s.pullreqStore.FindByNumber(ctx, repoID, prNum) pr, err := s.pullreqStore.FindByNumber(ctx, repoID, prNum)
if err != nil { if err != nil {
return fmt.Errorf("failed to get pull request number %d: %w", prNum, err) return fmt.Errorf("failed to get pull request number %d: %w", prNum, err)
@ -227,13 +231,12 @@ func (s *Service) updateMergeData(
// TODO: gitrpc should return sha's either way, and also conflicting files! // TODO: gitrpc should return sha's either way, and also conflicting files!
pr.MergeCheckStatus = enum.MergeCheckStatusConflict pr.MergeCheckStatus = enum.MergeCheckStatusConflict
pr.MergeTargetSHA = &output.BaseSHA pr.MergeTargetSHA = &output.BaseSHA
pr.MergeBaseSHA = &output.MergeBaseSHA
pr.MergeSHA = nil pr.MergeSHA = nil
pr.MergeConflicts = nil pr.MergeConflicts = nil
} else { } else {
pr.MergeCheckStatus = enum.MergeCheckStatusMergeable pr.MergeCheckStatus = enum.MergeCheckStatusMergeable
pr.MergeTargetSHA = &output.BaseSHA pr.MergeTargetSHA = &output.BaseSHA
pr.MergeBaseSHA = &output.MergeBaseSHA pr.MergeBaseSHA = output.MergeBaseSHA // TODO: Merge check should not update the merge base.
pr.MergeSHA = &output.MergeSHA pr.MergeSHA = &output.MergeSHA
pr.MergeConflicts = nil pr.MergeConflicts = nil
} }
@ -243,14 +246,5 @@ func (s *Service) updateMergeData(
return fmt.Errorf("failed to update PR merge ref in db with error: %w", err) return fmt.Errorf("failed to update PR merge ref in db with error: %w", err)
} }
if pr.MergeBaseSHA != nil && *pr.MergeBaseSHA != output.MergeBaseSHA {
oldMergeBaseSHA := *pr.MergeBaseSHA
newMergeBaseSHA := output.MergeBaseSHA
err = s.updateCodeCommentsOnMergeBaseUpdate(ctx, pr, sourceRepo.GitUID, oldMergeBaseSHA, newMergeBaseSHA)
if err != nil {
return fmt.Errorf("failed to update code comment after merge base SHA change: %w", err)
}
}
return nil return nil
} }

View File

@ -103,6 +103,10 @@ func (s *CodeCommentView) list(ctx context.Context,
// UpdateAll updates all code comments provided in the slice. // UpdateAll updates all code comments provided in the slice.
func (s *CodeCommentView) UpdateAll(ctx context.Context, codeComments []*types.CodeComment) error { func (s *CodeCommentView) UpdateAll(ctx context.Context, codeComments []*types.CodeComment) error {
if len(codeComments) == 0 {
return nil
}
const sqlQuery = ` const sqlQuery = `
UPDATE pullreq_activities UPDATE pullreq_activities
SET SET

View File

@ -0,0 +1,4 @@
ALTER TABLE pullreqs
ALTER COLUMN pullreq_merge_base_sha DROP DEFAULT,
ALTER COLUMN pullreq_merge_base_sha DROP NOT NULL;
UPDATE pullreqs SET pullreq_merge_base_sha = NULL WHERE pullreq_merge_base_sha = '';

View File

@ -0,0 +1,4 @@
UPDATE pullreqs SET pullreq_merge_base_sha = '' WHERE pullreq_merge_base_sha IS NULL;
ALTER TABLE pullreqs
ALTER COLUMN pullreq_merge_base_sha SET DEFAULT '',
ALTER COLUMN pullreq_merge_base_sha SET NOT NULL;

View File

@ -0,0 +1,4 @@
ALTER TABLE pullreqs ADD COLUMN pullreq_merge_base_sha_nullable TEXT;
UPDATE pullreqs SET pullreq_merge_base_sha_nullable = pullreq_merge_base_sha WHERE pullreq_merge_base_sha <> '';
ALTER TABLE pullreqs DROP COLUMN pullreq_merge_base_sha;
ALTER TABLE pullreqs RENAME COLUMN pullreq_merge_base_sha_nullable TO pullreq_merge_base_sha;

View File

@ -0,0 +1,4 @@
ALTER TABLE pullreqs ADD COLUMN pullreq_merge_base_sha_not_nullable TEXT NOT NULL DEFAULT '';
UPDATE pullreqs SET pullreq_merge_base_sha_not_nullable = pullreq_merge_base_sha WHERE pullreq_merge_base_sha IS NOT NULL;
ALTER TABLE pullreqs DROP COLUMN pullreq_merge_base_sha;
ALTER TABLE pullreqs RENAME COLUMN pullreq_merge_base_sha_not_nullable TO pullreq_merge_base_sha;

View File

@ -73,7 +73,7 @@ type pullReq struct {
MergeCheckStatus enum.MergeCheckStatus `db:"pullreq_merge_check_status"` MergeCheckStatus enum.MergeCheckStatus `db:"pullreq_merge_check_status"`
MergeTargetSHA null.String `db:"pullreq_merge_target_sha"` MergeTargetSHA null.String `db:"pullreq_merge_target_sha"`
MergeBaseSHA null.String `db:"pullreq_merge_base_sha"` MergeBaseSHA string `db:"pullreq_merge_base_sha"`
MergeSHA null.String `db:"pullreq_merge_sha"` MergeSHA null.String `db:"pullreq_merge_sha"`
MergeConflicts null.String `db:"pullreq_merge_conflicts"` MergeConflicts null.String `db:"pullreq_merge_conflicts"`
} }
@ -481,7 +481,7 @@ func mapPullReq(pr *pullReq) *types.PullReq {
MergeMethod: (*enum.MergeMethod)(pr.MergeMethod.Ptr()), MergeMethod: (*enum.MergeMethod)(pr.MergeMethod.Ptr()),
MergeCheckStatus: pr.MergeCheckStatus, MergeCheckStatus: pr.MergeCheckStatus,
MergeTargetSHA: pr.MergeTargetSHA.Ptr(), MergeTargetSHA: pr.MergeTargetSHA.Ptr(),
MergeBaseSHA: pr.MergeBaseSHA.Ptr(), MergeBaseSHA: pr.MergeBaseSHA,
MergeSHA: pr.MergeSHA.Ptr(), MergeSHA: pr.MergeSHA.Ptr(),
MergeConflicts: pr.MergeConflicts.Ptr(), MergeConflicts: pr.MergeConflicts.Ptr(),
Author: types.PrincipalInfo{}, Author: types.PrincipalInfo{},
@ -521,7 +521,7 @@ func mapInternalPullReq(pr *types.PullReq) *pullReq {
MergeMethod: null.StringFromPtr((*string)(pr.MergeMethod)), MergeMethod: null.StringFromPtr((*string)(pr.MergeMethod)),
MergeCheckStatus: pr.MergeCheckStatus, MergeCheckStatus: pr.MergeCheckStatus,
MergeTargetSHA: null.StringFromPtr(pr.MergeTargetSHA), MergeTargetSHA: null.StringFromPtr(pr.MergeTargetSHA),
MergeBaseSHA: null.StringFromPtr(pr.MergeBaseSHA), MergeBaseSHA: pr.MergeBaseSHA,
MergeSHA: null.StringFromPtr(pr.MergeSHA), MergeSHA: null.StringFromPtr(pr.MergeSHA),
MergeConflicts: null.StringFromPtr(pr.MergeConflicts), MergeConflicts: null.StringFromPtr(pr.MergeConflicts),
} }

View File

@ -41,7 +41,7 @@ type PullReq struct {
MergeCheckStatus enum.MergeCheckStatus `json:"merge_check_status"` MergeCheckStatus enum.MergeCheckStatus `json:"merge_check_status"`
MergeTargetSHA *string `json:"merge_target_sha"` MergeTargetSHA *string `json:"merge_target_sha"`
MergeBaseSHA *string `json:"merge_base_sha"` MergeBaseSHA string `json:"merge_base_sha"`
MergeSHA *string `json:"merge_sha"` MergeSHA *string `json:"merge_sha"`
MergeConflicts *string `json:"merge_conflicts,omitempty"` MergeConflicts *string `json:"merge_conflicts,omitempty"`