mirror of https://github.com/harness/drone.git
feat: [CODE-989]: add support for diff file stats (#690)
parent
4b57fe65a5
commit
4a741f9c30
|
@ -127,6 +127,29 @@ func (c *Client) DiffShortStat(ctx context.Context, params *DiffParams) (DiffSho
|
|||
}, nil
|
||||
}
|
||||
|
||||
type DiffFileStatOutput struct {
|
||||
Files []string
|
||||
}
|
||||
|
||||
func (c *Client) DiffFileStat(ctx context.Context, params *DiffParams) (DiffFileStatOutput, error) {
|
||||
if err := params.Validate(); err != nil {
|
||||
return DiffFileStatOutput{}, err
|
||||
}
|
||||
fileStat, err := c.diffService.DiffFileStat(ctx, &rpc.DiffRequest{
|
||||
Base: mapToRPCReadRequest(params.ReadParams),
|
||||
BaseRef: params.BaseRef,
|
||||
HeadRef: params.HeadRef,
|
||||
MergeBase: params.MergeBase,
|
||||
})
|
||||
if err != nil {
|
||||
return DiffFileStatOutput{}, processRPCErrorf(err, "failed to get diff file data between '%s' and '%s'",
|
||||
params.BaseRef, params.HeadRef)
|
||||
}
|
||||
return DiffFileStatOutput{
|
||||
Files: fileStat.GetFiles(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type DiffStatsOutput struct {
|
||||
Commits int
|
||||
FilesChanged int
|
||||
|
|
|
@ -65,6 +65,7 @@ type Interface interface {
|
|||
*/
|
||||
RawDiff(ctx context.Context, in *DiffParams, w io.Writer) error
|
||||
Diff(ctx context.Context, in *DiffParams) (<-chan *FileDiff, <-chan error)
|
||||
DiffFileStat(ctx context.Context, in *DiffParams) (DiffFileStatOutput, error)
|
||||
CommitDiff(ctx context.Context, params *GetCommitParams, w io.Writer) error
|
||||
DiffShortStat(ctx context.Context, params *DiffParams) (DiffShortStatOutput, error)
|
||||
DiffStats(ctx context.Context, params *DiffParams) (DiffStatsOutput, error)
|
||||
|
|
|
@ -188,6 +188,22 @@ func (g Adapter) DiffCut(
|
|||
return diffCutHeader, linesHunk, nil
|
||||
}
|
||||
|
||||
func (g Adapter) DiffFileStat(
|
||||
ctx context.Context,
|
||||
repoPath string,
|
||||
baseRef string,
|
||||
headRef string,
|
||||
) ([]string, error) {
|
||||
cmd := git.NewCommand(ctx,
|
||||
"diff", "--name-only", headRef, baseRef)
|
||||
stdout, _, runErr := cmd.RunStdBytes(&git.RunOpts{Dir: repoPath})
|
||||
if runErr != nil {
|
||||
return nil, processGiteaErrorf(runErr, "failed to trigger diff command")
|
||||
}
|
||||
|
||||
return parseLinesToSlice(stdout), nil
|
||||
}
|
||||
|
||||
func parseDiffStderr(stderr *bytes.Buffer) error {
|
||||
errRaw := stderr.String() // assume there will never be a lot of output to stdout
|
||||
if len(errRaw) == 0 {
|
||||
|
|
|
@ -151,6 +151,20 @@ func (s DiffService) GetDiffHunkHeaders(
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s DiffService) DiffFileStat(
|
||||
ctx context.Context,
|
||||
r *rpc.DiffRequest,
|
||||
) (*rpc.DiffFileStatResponse, error) {
|
||||
base := r.GetBase()
|
||||
repoPath := getFullPathForRepo(s.reposRoot, base.GetRepoUid())
|
||||
|
||||
files, err := s.adapter.DiffFileStat(ctx, repoPath, r.BaseRef, r.HeadRef)
|
||||
if err != nil {
|
||||
return nil, processGitErrorf(err, "failed to get diff file stat")
|
||||
}
|
||||
return &rpc.DiffFileStatResponse{Files: files}, nil
|
||||
}
|
||||
|
||||
func (s DiffService) DiffCut(
|
||||
ctx context.Context,
|
||||
r *rpc.DiffCutRequest,
|
||||
|
|
|
@ -110,4 +110,10 @@ type GitAdapter interface {
|
|||
dirPath string,
|
||||
regExpDef string,
|
||||
maxSize int) ([]types.FileContent, error)
|
||||
|
||||
DiffFileStat(
|
||||
ctx context.Context,
|
||||
repoPath string,
|
||||
baseRef string,
|
||||
headRef string) ([]string, error)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ service DiffService {
|
|||
rpc DiffShortStat(DiffRequest) returns (DiffShortStatResponse) {}
|
||||
rpc GetDiffHunkHeaders(GetDiffHunkHeadersRequest) returns (GetDiffHunkHeadersResponse) {}
|
||||
rpc DiffCut(DiffCutRequest) returns (DiffCutResponse) {}
|
||||
rpc DiffFileStat(DiffRequest) returns (DiffFileStatResponse) {}
|
||||
}
|
||||
|
||||
message DiffRequest {
|
||||
|
@ -135,4 +136,8 @@ message CommitDiffRequest {
|
|||
|
||||
message CommitDiffResponse {
|
||||
bytes data = 1;
|
||||
}
|
||||
|
||||
message DiffFileStatResponse {
|
||||
repeated string files = 1;
|
||||
}
|
|
@ -1021,6 +1021,53 @@ func (x *CommitDiffResponse) GetData() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
type DiffFileStatResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Files []string `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DiffFileStatResponse) Reset() {
|
||||
*x = DiffFileStatResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_diff_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DiffFileStatResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DiffFileStatResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DiffFileStatResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_diff_proto_msgTypes[13]
|
||||
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 DiffFileStatResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DiffFileStatResponse) Descriptor() ([]byte, []int) {
|
||||
return file_diff_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *DiffFileStatResponse) GetFiles() []string {
|
||||
if x != nil {
|
||||
return x.Files
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_diff_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_diff_proto_rawDesc = []byte{
|
||||
|
@ -1161,34 +1208,41 @@ var file_diff_proto_rawDesc = []byte{
|
|||
0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x22, 0x28, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
|
||||
0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||
0x32, 0x88, 0x03, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x12, 0x35, 0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x12, 0x10, 0x2e, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e,
|
||||
0x72, 0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x2f, 0x0a, 0x04, 0x44, 0x69, 0x66, 0x66, 0x12,
|
||||
0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x11, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d,
|
||||
0x69, 0x74, 0x44, 0x69, 0x66, 0x66, 0x12, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d,
|
||||
0x6d, 0x69, 0x74, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17,
|
||||
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x66, 0x66, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x66,
|
||||
0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63,
|
||||
0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12, 0x47, 0x65,
|
||||
0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 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,
|
||||
0x22, 0x2c, 0x0a, 0x14, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0xc7,
|
||||
0x03, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35,
|
||||
0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x2f, 0x0a, 0x04, 0x44, 0x69, 0x66, 0x66, 0x12, 0x10, 0x2e,
|
||||
0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x11, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
|
||||
0x44, 0x69, 0x66, 0x66, 0x12, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
|
||||
0x74, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x66, 0x66, 0x53,
|
||||
0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44,
|
||||
0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63,
|
||||
0x2e, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44,
|
||||
0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 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, 0x12, 0x3d, 0x0a, 0x0c, 0x44, 0x69, 0x66,
|
||||
0x66, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 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 (
|
||||
|
@ -1204,7 +1258,7 @@ func file_diff_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_diff_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_diff_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_diff_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_diff_proto_goTypes = []interface{}{
|
||||
(DiffResponse_FileStatus)(0), // 0: rpc.DiffResponse.FileStatus
|
||||
(*DiffRequest)(nil), // 1: rpc.DiffRequest
|
||||
|
@ -1220,34 +1274,37 @@ var file_diff_proto_goTypes = []interface{}{
|
|||
(*DiffResponse)(nil), // 11: rpc.DiffResponse
|
||||
(*CommitDiffRequest)(nil), // 12: rpc.CommitDiffRequest
|
||||
(*CommitDiffResponse)(nil), // 13: rpc.CommitDiffResponse
|
||||
nil, // 14: rpc.DiffFileHeader.ExtensionsEntry
|
||||
(*ReadRequest)(nil), // 15: rpc.ReadRequest
|
||||
(*DiffFileStatResponse)(nil), // 14: rpc.DiffFileStatResponse
|
||||
nil, // 15: rpc.DiffFileHeader.ExtensionsEntry
|
||||
(*ReadRequest)(nil), // 16: rpc.ReadRequest
|
||||
}
|
||||
var file_diff_proto_depIdxs = []int32{
|
||||
15, // 0: rpc.DiffRequest.base:type_name -> rpc.ReadRequest
|
||||
14, // 1: rpc.DiffFileHeader.extensions:type_name -> rpc.DiffFileHeader.ExtensionsEntry
|
||||
16, // 0: rpc.DiffRequest.base:type_name -> rpc.ReadRequest
|
||||
15, // 1: rpc.DiffFileHeader.extensions:type_name -> rpc.DiffFileHeader.ExtensionsEntry
|
||||
5, // 2: rpc.DiffFileHunkHeaders.file_header:type_name -> rpc.DiffFileHeader
|
||||
4, // 3: rpc.DiffFileHunkHeaders.hunk_headers:type_name -> rpc.HunkHeader
|
||||
15, // 4: rpc.GetDiffHunkHeadersRequest.base:type_name -> rpc.ReadRequest
|
||||
16, // 4: rpc.GetDiffHunkHeadersRequest.base:type_name -> rpc.ReadRequest
|
||||
6, // 5: rpc.GetDiffHunkHeadersResponse.files:type_name -> rpc.DiffFileHunkHeaders
|
||||
15, // 6: rpc.DiffCutRequest.base:type_name -> rpc.ReadRequest
|
||||
16, // 6: rpc.DiffCutRequest.base:type_name -> rpc.ReadRequest
|
||||
4, // 7: rpc.DiffCutResponse.hunk_header:type_name -> rpc.HunkHeader
|
||||
0, // 8: rpc.DiffResponse.status:type_name -> rpc.DiffResponse.FileStatus
|
||||
15, // 9: rpc.CommitDiffRequest.base:type_name -> rpc.ReadRequest
|
||||
16, // 9: rpc.CommitDiffRequest.base:type_name -> rpc.ReadRequest
|
||||
1, // 10: rpc.DiffService.RawDiff:input_type -> rpc.DiffRequest
|
||||
1, // 11: rpc.DiffService.Diff:input_type -> rpc.DiffRequest
|
||||
12, // 12: rpc.DiffService.CommitDiff:input_type -> rpc.CommitDiffRequest
|
||||
1, // 13: rpc.DiffService.DiffShortStat:input_type -> rpc.DiffRequest
|
||||
7, // 14: rpc.DiffService.GetDiffHunkHeaders:input_type -> rpc.GetDiffHunkHeadersRequest
|
||||
9, // 15: rpc.DiffService.DiffCut:input_type -> rpc.DiffCutRequest
|
||||
2, // 16: rpc.DiffService.RawDiff:output_type -> rpc.RawDiffResponse
|
||||
11, // 17: rpc.DiffService.Diff:output_type -> rpc.DiffResponse
|
||||
13, // 18: rpc.DiffService.CommitDiff:output_type -> rpc.CommitDiffResponse
|
||||
3, // 19: rpc.DiffService.DiffShortStat:output_type -> rpc.DiffShortStatResponse
|
||||
8, // 20: rpc.DiffService.GetDiffHunkHeaders:output_type -> rpc.GetDiffHunkHeadersResponse
|
||||
10, // 21: rpc.DiffService.DiffCut:output_type -> rpc.DiffCutResponse
|
||||
16, // [16:22] is the sub-list for method output_type
|
||||
10, // [10:16] is the sub-list for method input_type
|
||||
1, // 16: rpc.DiffService.DiffFileStat:input_type -> rpc.DiffRequest
|
||||
2, // 17: rpc.DiffService.RawDiff:output_type -> rpc.RawDiffResponse
|
||||
11, // 18: rpc.DiffService.Diff:output_type -> rpc.DiffResponse
|
||||
13, // 19: rpc.DiffService.CommitDiff:output_type -> rpc.CommitDiffResponse
|
||||
3, // 20: rpc.DiffService.DiffShortStat:output_type -> rpc.DiffShortStatResponse
|
||||
8, // 21: rpc.DiffService.GetDiffHunkHeaders:output_type -> rpc.GetDiffHunkHeadersResponse
|
||||
10, // 22: rpc.DiffService.DiffCut:output_type -> rpc.DiffCutResponse
|
||||
14, // 23: rpc.DiffService.DiffFileStat:output_type -> rpc.DiffFileStatResponse
|
||||
17, // [17:24] is the sub-list for method output_type
|
||||
10, // [10:17] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
|
@ -1416,6 +1473,18 @@ func file_diff_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_diff_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DiffFileStatResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -1423,7 +1492,7 @@ func file_diff_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_diff_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 14,
|
||||
NumMessages: 15,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ type DiffServiceClient interface {
|
|||
DiffShortStat(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffShortStatResponse, error)
|
||||
GetDiffHunkHeaders(ctx context.Context, in *GetDiffHunkHeadersRequest, opts ...grpc.CallOption) (*GetDiffHunkHeadersResponse, error)
|
||||
DiffCut(ctx context.Context, in *DiffCutRequest, opts ...grpc.CallOption) (*DiffCutResponse, error)
|
||||
DiffFileStat(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffFileStatResponse, error)
|
||||
}
|
||||
|
||||
type diffServiceClient struct {
|
||||
|
@ -161,6 +162,15 @@ func (c *diffServiceClient) DiffCut(ctx context.Context, in *DiffCutRequest, opt
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *diffServiceClient) DiffFileStat(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffFileStatResponse, error) {
|
||||
out := new(DiffFileStatResponse)
|
||||
err := c.cc.Invoke(ctx, "/rpc.DiffService/DiffFileStat", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DiffServiceServer is the server API for DiffService service.
|
||||
// All implementations must embed UnimplementedDiffServiceServer
|
||||
// for forward compatibility
|
||||
|
@ -171,6 +181,7 @@ type DiffServiceServer interface {
|
|||
DiffShortStat(context.Context, *DiffRequest) (*DiffShortStatResponse, error)
|
||||
GetDiffHunkHeaders(context.Context, *GetDiffHunkHeadersRequest) (*GetDiffHunkHeadersResponse, error)
|
||||
DiffCut(context.Context, *DiffCutRequest) (*DiffCutResponse, error)
|
||||
DiffFileStat(context.Context, *DiffRequest) (*DiffFileStatResponse, error)
|
||||
mustEmbedUnimplementedDiffServiceServer()
|
||||
}
|
||||
|
||||
|
@ -196,6 +207,9 @@ func (UnimplementedDiffServiceServer) GetDiffHunkHeaders(context.Context, *GetDi
|
|||
func (UnimplementedDiffServiceServer) DiffCut(context.Context, *DiffCutRequest) (*DiffCutResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DiffCut not implemented")
|
||||
}
|
||||
func (UnimplementedDiffServiceServer) DiffFileStat(context.Context, *DiffRequest) (*DiffFileStatResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DiffFileStat not implemented")
|
||||
}
|
||||
func (UnimplementedDiffServiceServer) mustEmbedUnimplementedDiffServiceServer() {}
|
||||
|
||||
// UnsafeDiffServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
@ -326,6 +340,24 @@ func _DiffService_DiffCut_Handler(srv interface{}, ctx context.Context, dec func
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DiffService_DiffFileStat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DiffRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DiffServiceServer).DiffFileStat(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/rpc.DiffService/DiffFileStat",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DiffServiceServer).DiffFileStat(ctx, req.(*DiffRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// DiffService_ServiceDesc is the grpc.ServiceDesc for DiffService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -345,6 +377,10 @@ var DiffService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "DiffCut",
|
||||
Handler: _DiffService_DiffCut_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DiffFileStat",
|
||||
Handler: _DiffService_DiffFileStat_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue