drone/gitrpc/proto/diff.proto
2023-04-13 14:12:01 +02:00

85 lines
2.0 KiB
Protocol Buffer

syntax = "proto3";
package rpc;
option go_package = "github.com/harness/gitness/gitrpc/rpc";
import "shared.proto";
// DiffService is a service which provides RPCs to inspect differences
// introduced between a set of commits.
service DiffService {
rpc RawDiff(DiffRequest) returns (stream RawDiffResponse) {}
rpc DiffShortStat(DiffRequest) returns (DiffShortStatResponse) {}
rpc GetDiffHunkHeaders(GetDiffHunkHeadersRequest) returns (GetDiffHunkHeadersResponse) {}
rpc DiffCut(DiffCutRequest) returns (DiffCutResponse) {}
}
message DiffRequest {
ReadRequest base = 1;
// base_ref is left side of compare and can be branch, commit and tag
string base_ref = 2;
// head_ref is right side of compare and can be branch, commit and tag
string head_ref = 3;
// merge_base used only in branch comparison, if merge_base is true
// it will show diff from the commit where branch is created and head branch
bool merge_base = 4;
}
message RawDiffResponse {
bytes data = 1;
}
message DiffShortStatResponse {
int32 files = 1;
int32 additions = 2;
int32 deletions = 3;
}
message HunkHeader {
int32 old_line = 1;
int32 old_span = 2;
int32 new_line = 3;
int32 new_span = 4;
string text = 5;
}
message DiffFileHeader {
string old_file_name = 1;
string new_file_name = 2;
}
message DiffFileHunkHeaders {
DiffFileHeader file_header = 1;
repeated HunkHeader hunk_headers = 2;
}
message GetDiffHunkHeadersRequest {
ReadRequest base = 1;
string source_commit_sha = 2;
string target_commit_sha = 4;
}
message GetDiffHunkHeadersResponse {
repeated DiffFileHunkHeaders files = 1;
}
message DiffCutRequest {
ReadRequest base = 1;
string source_commit_sha = 2;
string source_branch = 3;
string target_commit_sha = 4;
string target_branch = 5;
string path = 6;
int32 line_start = 7;
bool line_start_new = 8;
int32 line_end = 9;
bool line_end_new = 10;
}
message DiffCutResponse {
HunkHeader hunk_header = 1;
repeated string lines = 2;
string merge_base_sha = 3;
string latest_source_sha = 4;
}