Merge branch 'main' into ui/code-comment-new-api

This commit is contained in:
“tan-nhu” 2023-04-28 10:38:51 -07:00
commit aadcc607c0
44 changed files with 859 additions and 395 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 {
@ -219,6 +220,7 @@ func (c *Client) GetDiffHunkHeaders(
type DiffCutOutput struct { type DiffCutOutput struct {
Header HunkHeader Header HunkHeader
LinesHeader string
Lines []string Lines []string
MergeBaseSHA string MergeBaseSHA string
LatestSourceSHA string LatestSourceSHA string
@ -276,6 +278,7 @@ func (c *Client) DiffCut(ctx context.Context, params *DiffCutParams) (DiffCutOut
return DiffCutOutput{ return DiffCutOutput{
Header: HunkHeader(hunkHeader), Header: HunkHeader(hunkHeader),
LinesHeader: result.LinesHeader,
Lines: result.Lines, Lines: result.Lines,
MergeBaseSHA: result.MergeBaseSha, MergeBaseSHA: result.MergeBaseSha,
LatestSourceSHA: result.LatestSourceSha, LatestSourceSHA: result.LatestSourceSha,

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

@ -122,7 +122,7 @@ func (g Adapter) DiffCut(
ctx context.Context, ctx context.Context,
repoPath, targetRef, sourceRef, path string, repoPath, targetRef, sourceRef, path string,
params types.DiffCutParams, params types.DiffCutParams,
) (types.Hunk, error) { ) (types.HunkHeader, types.Hunk, error) {
pipeRead, pipeWrite := io.Pipe() pipeRead, pipeWrite := io.Pipe()
stderr := &bytes.Buffer{} stderr := &bytes.Buffer{}
go func() { go func() {
@ -143,19 +143,19 @@ func (g Adapter) DiffCut(
}) })
}() }()
hunk, err := parser.DiffCut(pipeRead, params) diffCutHeader, linesHunk, err := parser.DiffCut(pipeRead, params)
// First check if there's something in the stderr buffer, if yes that's the error // First check if there's something in the stderr buffer, if yes that's the error
if errStderr := parseDiffStderr(stderr); errStderr != nil { if errStderr := parseDiffStderr(stderr); errStderr != nil {
return types.Hunk{}, errStderr return types.HunkHeader{}, types.Hunk{}, errStderr
} }
// Next check if reading the git diff output caused an error // Next check if reading the git diff output caused an error
if err != nil { if err != nil {
return types.Hunk{}, err return types.HunkHeader{}, types.Hunk{}, err
} }
return hunk, nil return diffCutHeader, linesHunk, nil
} }
func parseDiffStderr(stderr *bytes.Buffer) error { func parseDiffStderr(stderr *bytes.Buffer) error {

View File

@ -17,18 +17,18 @@ import (
// and returns lines specified with the parameters. // and returns lines specified with the parameters.
// //
//nolint:funlen,gocognit,nestif,gocognit,gocyclo,cyclop // it's actually very readable //nolint:funlen,gocognit,nestif,gocognit,gocyclo,cyclop // it's actually very readable
func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) { func DiffCut(r io.Reader, params types.DiffCutParams) (types.HunkHeader, types.Hunk, error) {
scanner := bufio.NewScanner(r) scanner := bufio.NewScanner(r)
var err error var err error
var hunkHeader types.HunkHeader var hunkHeader types.HunkHeader
if _, err = scanFileHeader(scanner); err != nil { if _, err = scanFileHeader(scanner); err != nil {
return types.Hunk{}, err return types.HunkHeader{}, types.Hunk{}, err
} }
if hunkHeader, err = scanHunkHeader(scanner); err != nil { if hunkHeader, err = scanHunkHeader(scanner); err != nil {
return types.Hunk{}, err return types.HunkHeader{}, types.Hunk{}, err
} }
currentOldLine := hunkHeader.OldLine currentOldLine := hunkHeader.OldLine
@ -51,7 +51,7 @@ func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
line, action, err = scanHunkLine(scanner) line, action, err = scanHunkLine(scanner)
if err != nil { if err != nil {
return types.Hunk{}, err return types.HunkHeader{}, types.Hunk{}, err
} }
if line == "" { if line == "" {
@ -93,7 +93,7 @@ func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
} }
if !inCut { if !inCut {
return types.Hunk{}, types.ErrHunkNotFound return types.HunkHeader{}, types.Hunk{}, types.ErrHunkNotFound
} }
var ( var (
@ -111,34 +111,36 @@ func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
linesAfter = append(linesAfter, line) linesAfter = append(linesAfter, line)
} }
if err = scanner.Err(); err != nil { if err = scanner.Err(); err != nil {
return types.Hunk{}, err return types.HunkHeader{}, types.Hunk{}, err
} }
} }
diffCutHeaderLines := diffCutHeader
for _, s := range linesBefore { for _, s := range linesBefore {
action := diffAction(s[0]) action := diffAction(s[0])
if action != actionRemoved { if action != actionRemoved {
diffCutHeader.NewLine-- diffCutHeaderLines.NewLine--
diffCutHeader.NewSpan++ diffCutHeaderLines.NewSpan++
} }
if action != actionAdded { if action != actionAdded {
diffCutHeader.OldLine-- diffCutHeaderLines.OldLine--
diffCutHeader.OldSpan++ diffCutHeaderLines.OldSpan++
} }
} }
for _, s := range linesAfter { for _, s := range linesAfter {
action := diffAction(s[0]) action := diffAction(s[0])
if action != actionRemoved { if action != actionRemoved {
diffCutHeader.NewSpan++ diffCutHeaderLines.NewSpan++
} }
if action != actionAdded { if action != actionAdded {
diffCutHeader.OldSpan++ diffCutHeaderLines.OldSpan++
} }
} }
return types.Hunk{ return diffCutHeader, types.Hunk{
HunkHeader: diffCutHeader, HunkHeader: diffCutHeaderLines,
Lines: concat(linesBefore, diffCut, linesAfter), Lines: concat(linesBefore, diffCut, linesAfter),
}, nil }, nil
} }

View File

@ -12,6 +12,7 @@ import (
"github.com/harness/gitness/gitrpc/internal/types" "github.com/harness/gitness/gitrpc/internal/types"
) )
//nolint:gocognit // it's a unit test!!!
func TestDiffCut(t *testing.T) { func TestDiffCut(t *testing.T) {
const input = `diff --git a/test.txt b/test.txt const input = `diff --git a/test.txt b/test.txt
--- a/test.txt --- a/test.txt
@ -107,7 +108,7 @@ func TestDiffCut(t *testing.T) {
for _, test := range tests { for _, test := range tests {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
hunk, err := DiffCut( hunkHeader, linesHunk, err := DiffCut(
strings.NewReader(input), strings.NewReader(input),
test.params, test.params,
) )
@ -122,11 +123,19 @@ func TestDiffCut(t *testing.T) {
return return
} }
if want, got := test.expCutHeader, hunk.HunkHeader.String(); want != got { if test.params.LineStartNew && test.params.LineStart != hunkHeader.NewLine {
t.Errorf("hunk line start mismatch: want=%d got=%d", test.params.LineStart, hunkHeader.NewLine)
}
if !test.params.LineStartNew && test.params.LineStart != hunkHeader.OldLine {
t.Errorf("hunk line start mismatch: want=%d got=%d", test.params.LineStart, hunkHeader.OldLine)
}
if want, got := test.expCutHeader, linesHunk.String(); want != got {
t.Errorf("header mismatch: want=%s got=%s", want, got) t.Errorf("header mismatch: want=%s got=%s", want, got)
} }
if want, got := test.expCut, hunk.Lines; !reflect.DeepEqual(want, got) { if want, got := test.expCut, linesHunk.Lines; !reflect.DeepEqual(want, got) {
t.Errorf("lines mismatch: want=%s got=%s", want, got) t.Errorf("lines mismatch: want=%s got=%s", want, got)
} }
}) })

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,28 +124,33 @@ 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")
} }
hunk, err := s.adapter.DiffCut(ctx, repoPath, r.TargetCommitSha, r.SourceCommitSha, r.Path, types.DiffCutParams{ diffHunkHeader, linesHunk, err := s.adapter.DiffCut(ctx,
LineStart: int(r.LineStart), repoPath,
LineStartNew: r.LineStartNew, r.TargetCommitSha, r.SourceCommitSha,
LineEnd: int(r.LineEnd), r.Path,
LineEndNew: r.LineEndNew, types.DiffCutParams{
BeforeLines: 2, LineStart: int(r.LineStart),
AfterLines: 2, LineStartNew: r.LineStartNew,
LineLimit: 40, LineEnd: int(r.LineEnd),
}) LineEndNew: r.LineEndNew,
BeforeLines: 2,
AfterLines: 2,
LineLimit: 40,
})
if err != nil { if err != nil {
return nil, processGitErrorf(err, "failed to get diff hunk") return nil, processGitErrorf(err, "failed to get diff hunk")
} }
return &rpc.DiffCutResponse{ return &rpc.DiffCutResponse{
HunkHeader: mapHunkHeader(hunk.HunkHeader), HunkHeader: mapHunkHeader(diffHunkHeader),
Lines: hunk.Lines, LinesHeader: linesHunk.HunkHeader.String(),
Lines: linesHunk.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)
@ -53,6 +55,6 @@ type GitAdapter interface {
baseRef string, headRef string, direct bool) (types.DiffShortStat, error) baseRef string, headRef string, direct bool) (types.DiffShortStat, error)
GetDiffHunkHeaders(ctx context.Context, repoPath, targetRef, sourceRef string) ([]*types.DiffFileHunkHeaders, error) GetDiffHunkHeaders(ctx context.Context, repoPath, targetRef, sourceRef string) ([]*types.DiffFileHunkHeaders, error)
DiffCut(ctx context.Context, repoPath, targetRef, sourceRef, path string, DiffCut(ctx context.Context, repoPath, targetRef, sourceRef, path string,
params types.DiffCutParams) (types.Hunk, error) params types.DiffCutParams) (types.HunkHeader, types.Hunk, error)
Blame(ctx context.Context, repoPath, rev, file string, lineFrom, lineTo int) types.BlameReader Blame(ctx context.Context, repoPath, rev, file string, lineFrom, lineTo int) types.BlameReader
} }

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 {
@ -78,7 +79,8 @@ message DiffCutRequest {
message DiffCutResponse { message DiffCutResponse {
HunkHeader hunk_header = 1; HunkHeader hunk_header = 1;
repeated string lines = 2; string lines_header = 2;
string merge_base_sha = 3; repeated string lines = 3;
string latest_source_sha = 4; string merge_base_sha = 4;
string latest_source_sha = 5;
} }

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
@ -629,9 +637,10 @@ type DiffCutResponse struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
HunkHeader *HunkHeader `protobuf:"bytes,1,opt,name=hunk_header,json=hunkHeader,proto3" json:"hunk_header,omitempty"` HunkHeader *HunkHeader `protobuf:"bytes,1,opt,name=hunk_header,json=hunkHeader,proto3" json:"hunk_header,omitempty"`
Lines []string `protobuf:"bytes,2,rep,name=lines,proto3" json:"lines,omitempty"` LinesHeader string `protobuf:"bytes,2,opt,name=lines_header,json=linesHeader,proto3" json:"lines_header,omitempty"`
MergeBaseSha string `protobuf:"bytes,3,opt,name=merge_base_sha,json=mergeBaseSha,proto3" json:"merge_base_sha,omitempty"` Lines []string `protobuf:"bytes,3,rep,name=lines,proto3" json:"lines,omitempty"`
LatestSourceSha string `protobuf:"bytes,4,opt,name=latest_source_sha,json=latestSourceSha,proto3" json:"latest_source_sha,omitempty"` MergeBaseSha string `protobuf:"bytes,4,opt,name=merge_base_sha,json=mergeBaseSha,proto3" json:"merge_base_sha,omitempty"`
LatestSourceSha string `protobuf:"bytes,5,opt,name=latest_source_sha,json=latestSourceSha,proto3" json:"latest_source_sha,omitempty"`
} }
func (x *DiffCutResponse) Reset() { func (x *DiffCutResponse) Reset() {
@ -673,6 +682,13 @@ func (x *DiffCutResponse) GetHunkHeader() *HunkHeader {
return nil return nil
} }
func (x *DiffCutResponse) GetLinesHeader() string {
if x != nil {
return x.LinesHeader
}
return ""
}
func (x *DiffCutResponse) GetLines() []string { func (x *DiffCutResponse) GetLines() []string {
if x != nil { if x != nil {
return x.Lines return x.Lines
@ -725,90 +741,101 @@ 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, 0xce, 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, 0x21, 0x0a, 0x0c,
0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x62,
0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d,
0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x6c,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x68, 0x61,
0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x6f,
0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x75, 0x72, 0x63, 0x65, 0x53, 0x68, 0x61, 0x32, 0x96, 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66,
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69,
0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x66, 0x66, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71,
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69,
0x12, 0x36, 0x0a, 0x07, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f,
0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x0a, 0x0d, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12,
0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65,
0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1e, 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,
0x71, 0x75, 0x65, 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 +850,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 +862,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 +1023,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

@ -120,7 +120,7 @@ func (c *Controller) CommentCreate(
setAsCodeComment(act, cut, in.Path, in.SourceCommitSHA) setAsCodeComment(act, cut, in.Path, in.SourceCommitSHA)
_ = act.SetPayload(&types.PullRequestActivityPayloadCodeComment{ _ = act.SetPayload(&types.PullRequestActivityPayloadCodeComment{
Title: cut.Header.Text, Title: cut.LinesHeader,
Lines: cut.Lines, Lines: cut.Lines,
AnyNew: cut.AnyNew, AnyNew: cut.AnyNew,
}) })
@ -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

@ -20,6 +20,7 @@ func (c *Controller) RawDiff(
session *auth.Session, session *auth.Session,
repoRef string, repoRef string,
pullreqNum int64, pullreqNum int64,
setSHAs func(sourceSHA, mergeBaseSHA string),
w io.Writer, w io.Writer,
) error { ) error {
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoView) repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoView)
@ -32,14 +33,10 @@ 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
} setSHAs(headRef, baseRef)
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

@ -30,7 +30,12 @@ func HandleRawDiff(pullreqCtrl *pullreq.Controller) http.HandlerFunc {
return return
} }
if err = pullreqCtrl.RawDiff(ctx, session, repoRef, pullreqNumber, w); err != nil { setSHAs := func(sourceSHA, mergeBaseSHA string) {
w.Header().Set("X-Source-Sha", sourceSHA)
w.Header().Set("X-Merge-Base-Sha", mergeBaseSHA)
}
if err = pullreqCtrl.RawDiff(ctx, session, repoRef, pullreqNumber, setSHAs, w); err != nil {
render.TranslatedUserError(w, err) render.TranslatedUserError(w, err)
return return
} }

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"`

View File

@ -30,7 +30,7 @@ type PullReqActivity struct {
Created int64 `json:"created"` Created int64 `json:"created"`
Updated int64 `json:"-"` // not returned, it's updated by the server internally. Clients should use EditedAt. Updated int64 `json:"-"` // not returned, it's updated by the server internally. Clients should use EditedAt.
Edited int64 `json:"edited"` Edited int64 `json:"edited"`
Deleted *int64 `json:"deleted"` Deleted *int64 `json:"deleted,omitempty"`
ParentID *int64 `json:"parent_id"` ParentID *int64 `json:"parent_id"`
RepoID int64 `json:"repo_id"` RepoID int64 `json:"repo_id"`
@ -48,19 +48,19 @@ type PullReqActivity struct {
Metadata map[string]interface{} `json:"metadata"` Metadata map[string]interface{} `json:"metadata"`
ResolvedBy *int64 `json:"-"` // not returned, because the resolver info is in the Resolver field ResolvedBy *int64 `json:"-"` // not returned, because the resolver info is in the Resolver field
Resolved *int64 `json:"resolved"` Resolved *int64 `json:"resolved,omitempty"`
Author PrincipalInfo `json:"author"` Author PrincipalInfo `json:"author"`
Resolver *PrincipalInfo `json:"resolver"` Resolver *PrincipalInfo `json:"resolver,omitempty"`
Outdated *bool `json:"outdated"` Outdated *bool `json:"outdated,omitempty"`
CodeCommentMergeBaseSHA *string `json:"code_comment_merge_base_sha"` CodeCommentMergeBaseSHA *string `json:"code_comment_merge_base_sha,omitempty"`
CodeCommentSourceSHA *string `json:"code_comment_source_sha"` CodeCommentSourceSHA *string `json:"code_comment_source_sha,omitempty"`
CodeCommentPath *string `json:"code_comment_path"` CodeCommentPath *string `json:"code_comment_path,omitempty"`
CodeCommentLineNew *int64 `json:"code_comment_line_new"` CodeCommentLineNew *int64 `json:"code_comment_line_new,omitempty"`
CodeCommentSpanNew *int64 `json:"code_comment_span_new"` CodeCommentSpanNew *int64 `json:"code_comment_span_new,omitempty"`
CodeCommentLineOld *int64 `json:"code_comment_line_old"` CodeCommentLineOld *int64 `json:"code_comment_line_old,omitempty"`
CodeCommentSpanOld *int64 `json:"code_comment_span_old"` CodeCommentSpanOld *int64 `json:"code_comment_span_old,omitempty"`
} }
func (a *PullReqActivity) IsValidCodeComment() bool { func (a *PullReqActivity) IsValidCodeComment() bool {