Files
gitks/proto/diff.proto
T
zhenyi 66afd932ed feat(api): extend commit and diff services with new functionality
- Add FindCommit, ListCommitsByOid, CommitIsAncestor RPCs to CommitService
- Add CheckObjectsExist, CommitsByMessage, GetCommitStats RPCs to CommitService
- Add LastCommitForPath, CountCommits, CountDivergingCommits RPCs to CommitService
- Add RawDiff, RawPatch, FindChangedPaths RPCs to DiffService
- Add FindMergeBase, WriteRef, SearchFilesByContent RPCs to RepositoryService
- Add SearchFilesByName, ObjectsSize, RepositorySize RPCs to RepositoryService
- Add FindLicense, OptimizeRepository, GetRawChanges RPCs to RepositoryService
- Add FetchRemote, CreateRepositoryFromURL RPCs to RepositoryService
- Implement server handlers for all new RPC methods
- Add new modules for commit counting, finding, and querying features
- Add new modules for diff changed paths and raw operations
- Add new modules for refs and remote operations
- Remove unnecessary comments from various source files
- Update proto definitions with new message types and service methods
2026-06-08 15:37:08 +08:00

199 lines
4.3 KiB
Protocol Buffer

syntax = "proto3";
package gitks;
import "oid.proto";
import "repository.proto";
message DiffOptions {
enum WhitespaceMode {
DIFF_WHITESPACE_MODE_UNSPECIFIED = 0;
DIFF_WHITESPACE_MODE_DEFAULT = 1;
DIFF_WHITESPACE_MODE_IGNORE_ALL = 2;
DIFF_WHITESPACE_MODE_IGNORE_CHANGE = 3;
DIFF_WHITESPACE_MODE_IGNORE_EOL = 4;
}
bool recursive = 1;
bool include_binary = 2;
bool include_patch = 3;
bool rename_detection = 4;
bool copy_detection = 5;
uint32 context_lines = 6;
repeated string pathspec = 7;
WhitespaceMode whitespace_mode = 8;
uint64 max_files = 9;
uint64 max_bytes = 10;
}
message DiffLine {
enum LineType {
DIFF_LINE_TYPE_UNSPECIFIED = 0;
DIFF_LINE_TYPE_CONTEXT = 1;
DIFF_LINE_TYPE_ADDED = 2;
DIFF_LINE_TYPE_DELETED = 3;
DIFF_LINE_TYPE_HUNK_HEADER = 4;
DIFF_LINE_TYPE_NO_NEWLINE = 5;
}
LineType type = 1;
int32 old_line = 2;
int32 new_line = 3;
bytes content = 4;
bool truncated = 5;
}
message DiffHunk {
string header = 1;
uint32 old_start = 2;
uint32 old_lines = 3;
uint32 new_start = 4;
uint32 new_lines = 5;
repeated DiffLine lines = 6;
}
message DiffFile {
enum ChangeType {
DIFF_FILE_CHANGE_TYPE_UNSPECIFIED = 0;
DIFF_FILE_CHANGE_TYPE_ADDED = 1;
DIFF_FILE_CHANGE_TYPE_MODIFIED = 2;
DIFF_FILE_CHANGE_TYPE_DELETED = 3;
DIFF_FILE_CHANGE_TYPE_RENAMED = 4;
DIFF_FILE_CHANGE_TYPE_COPIED = 5;
DIFF_FILE_CHANGE_TYPE_TYPE_CHANGED = 6;
DIFF_FILE_CHANGE_TYPE_UNMERGED = 7;
}
string old_path = 1;
string new_path = 2;
Oid old_oid = 3;
Oid new_oid = 4;
uint32 old_mode = 5;
uint32 new_mode = 6;
ChangeType change_type = 7;
bool binary = 8;
bool too_large = 9;
uint32 additions = 10;
uint32 deletions = 11;
repeated DiffHunk hunks = 12;
bytes patch = 13;
double similarity = 14;
}
message DiffStats {
uint32 additions = 1;
uint32 deletions = 2;
uint32 changed_files = 3;
}
message Diff {
repeated DiffFile files = 1;
DiffStats stats = 2;
bool overflow = 3;
}
message GetDiffRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
DiffOptions options = 4;
Pagination pagination = 5;
}
message GetDiffResponse {
repeated DiffFile files = 1;
DiffStats stats = 2;
PageInfo page_info = 3;
bool overflow = 4;
}
message GetCommitDiffRequest {
RepositoryHeader repository = 1;
ObjectSelector commit = 2;
DiffOptions options = 3;
Pagination pagination = 4;
}
message GetPatchRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
DiffOptions options = 4;
}
message GetPatchResponse {
bytes data = 1;
}
message GetDiffStatsRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
DiffOptions options = 4;
}
message RawDiffRequest {
RepositoryHeader repository = 1;
string base = 2; // revision or OID
string head = 3;
DiffOptions options = 4;
}
message RawDiffResponse {
bytes data = 1;
}
message RawPatchRequest {
RepositoryHeader repository = 1;
string base = 2;
string head = 3;
}
message RawPatchResponse {
bytes data = 1;
}
message FindChangedPathsRequest {
RepositoryHeader repository = 1;
string base = 2;
string head = 3;
repeated string paths = 4; // filter to these paths
}
message ChangedPath {
enum Status {
CHANGED_PATH_STATUS_UNSPECIFIED = 0;
CHANGED_PATH_STATUS_ADDED = 1;
CHANGED_PATH_STATUS_MODIFIED = 2;
CHANGED_PATH_STATUS_DELETED = 3;
CHANGED_PATH_STATUS_RENAMED = 4;
CHANGED_PATH_STATUS_COPIED = 5;
CHANGED_PATH_STATUS_TYPE_CHANGED = 6;
}
Status status = 1;
string old_path = 2;
string new_path = 3;
uint32 additions = 4;
uint32 deletions = 5;
bool binary = 6;
}
message FindChangedPathsResponse {
repeated ChangedPath paths = 1;
}
service DiffService {
rpc GetDiff(GetDiffRequest) returns (GetDiffResponse);
rpc GetCommitDiff(GetCommitDiffRequest) returns (GetDiffResponse);
rpc GetPatch(GetPatchRequest) returns (stream GetPatchResponse);
rpc GetDiffStats(GetDiffStatsRequest) returns (DiffStats);
rpc RawDiff(RawDiffRequest) returns (stream RawDiffResponse);
rpc RawPatch(RawPatchRequest) returns (stream RawPatchResponse);
rpc FindChangedPaths(FindChangedPathsRequest) returns (FindChangedPathsResponse);
}