Files
gitks/proto/commit.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

273 lines
6.4 KiB
Protocol Buffer

syntax = "proto3";
package gitks;
import "google/protobuf/timestamp.proto";
import "oid.proto";
import "repository.proto";
import "tagger.proto";
message PayloadCommit {
PayloadTagger author = 1;
PayloadTagger committer = 2;
Oid oid = 3;
string message = 4;
repeated Oid parents = 5;
Oid tree = 6;
google.protobuf.Timestamp timestamp = 7;
}
message CommitTrailer {
string key = 1;
string value = 2;
bool separator_present = 3;
}
message CommitStats {
uint32 additions = 1;
uint32 deletions = 2;
uint32 changed_files = 3;
}
message Commit {
Oid oid = 1;
string abbreviated_oid = 2;
repeated Oid parent_oids = 3;
Oid tree_oid = 4;
Signature author = 5;
Signature committer = 6;
string subject = 7;
string body = 8;
string message = 9;
repeated CommitTrailer trailers = 10;
VerifiedSignature signature = 11;
CommitStats stats = 12;
google.protobuf.Timestamp authored_at = 13;
google.protobuf.Timestamp committed_at = 14;
bytes raw = 15;
}
message ListCommitsRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
google.protobuf.Timestamp since = 4;
google.protobuf.Timestamp until = 5;
bool first_parent = 6;
bool all = 7;
bool reverse = 8;
uint32 max_parents = 9;
uint32 min_parents = 10;
Pagination pagination = 11;
}
message ListCommitsResponse {
repeated Commit commits = 1;
PageInfo page_info = 2;
}
message GetCommitRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
bool include_stats = 3;
bool include_raw = 4;
}
message GetCommitAncestorsRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
bool first_parent = 3;
Pagination pagination = 4;
}
message GetCommitAncestorsResponse {
repeated Commit commits = 1;
PageInfo page_info = 2;
}
message CreateCommitAction {
enum Action {
CREATE_COMMIT_ACTION_UNSPECIFIED = 0;
CREATE_COMMIT_ACTION_CREATE = 1;
CREATE_COMMIT_ACTION_UPDATE = 2;
CREATE_COMMIT_ACTION_DELETE = 3;
CREATE_COMMIT_ACTION_MOVE = 4;
CREATE_COMMIT_ACTION_CHMOD = 5;
}
Action action = 1;
string file_path = 2;
string previous_path = 3;
bytes content = 4;
string encoding = 5;
bool executable = 6;
Oid last_commit_oid = 7;
}
message CreateCommitRequest {
RepositoryHeader repository = 1;
string branch = 2;
string message = 3;
Signature author = 4;
Signature committer = 5;
repeated CreateCommitAction actions = 6;
ObjectSelector start_revision = 7;
bool force = 8;
repeated CommitTrailer trailers = 9;
}
message CreateCommitResponse {
Commit commit = 1;
string branch = 2;
}
message RevertCommitRequest {
RepositoryHeader repository = 1;
ObjectSelector commit = 2;
string branch = 3;
Signature committer = 4;
string message = 5;
}
message CherryPickCommitRequest {
RepositoryHeader repository = 1;
ObjectSelector commit = 2;
string branch = 3;
Signature committer = 4;
string message = 5;
uint32 mainline = 6;
}
message CompareCommitsRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
bool straight = 4;
bool first_parent = 5;
Pagination pagination = 6;
}
message CompareCommitsResponse {
repeated Commit commits = 1;
CommitStats stats = 2;
PageInfo page_info = 3;
Oid merge_base = 4;
}
message FindCommitRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
bool include_stats = 3;
}
message ListCommitsByOidRequest {
RepositoryHeader repository = 1;
repeated bytes oids = 2; // binary OID values
bool include_stats = 3;
}
message ListCommitsByOidResponse {
repeated Commit commits = 1;
}
message CommitIsAncestorRequest {
RepositoryHeader repository = 1;
string ancestor_oid = 2;
string descendant_oid = 3;
}
message CommitIsAncestorResponse {
bool is_ancestor = 1;
}
message CheckObjectsExistRequest {
RepositoryHeader repository = 1;
repeated string revisions = 2; // hex OIDs or rev expressions
}
message RevisionExistence {
string revision = 1;
bool exists = 2;
}
message CheckObjectsExistResponse {
repeated RevisionExistence revisions = 1;
}
message CommitsByMessageRequest {
RepositoryHeader repository = 1;
string query = 2; // regex or literal to search in commit messages
string revision = 3; // limit to this branch/ref (empty = all branches)
uint32 limit = 4;
uint32 offset = 5;
bool case_insensitive = 6;
}
message CommitsByMessageResponse {
repeated Commit commits = 1;
}
message GetCommitStatsRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
}
message LastCommitForPathRequest {
RepositoryHeader repository = 1;
string path = 2;
string revision = 3; // limit history to this ref
bool literal_pathspec = 4;
}
message LastCommitForPathResponse {
Commit commit = 1;
string path = 2;
}
message CountCommitsRequest {
RepositoryHeader repository = 1;
string revision = 2;
string path = 3;
string since = 4; // ISO 8601 date
string until = 5;
}
message CountCommitsResponse {
uint64 count = 1;
}
message CountDivergingCommitsRequest {
RepositoryHeader repository = 1;
string left = 2;
string right = 3;
}
message CountDivergingCommitsResponse {
uint64 left_count = 1;
uint64 right_count = 2;
}
service CommitService {
rpc ListCommits(ListCommitsRequest) returns (ListCommitsResponse);
rpc GetCommit(GetCommitRequest) returns (Commit);
rpc GetCommitAncestors(GetCommitAncestorsRequest) returns (GetCommitAncestorsResponse);
rpc CreateCommit(CreateCommitRequest) returns (CreateCommitResponse);
rpc RevertCommit(RevertCommitRequest) returns (CreateCommitResponse);
rpc CherryPickCommit(CherryPickCommitRequest) returns (CreateCommitResponse);
rpc CompareCommits(CompareCommitsRequest) returns (CompareCommitsResponse);
rpc FindCommit(FindCommitRequest) returns (Commit);
rpc ListCommitsByOid(ListCommitsByOidRequest) returns (ListCommitsByOidResponse);
rpc CommitIsAncestor(CommitIsAncestorRequest) returns (CommitIsAncestorResponse);
rpc CheckObjectsExist(CheckObjectsExistRequest) returns (CheckObjectsExistResponse);
rpc CommitsByMessage(CommitsByMessageRequest) returns (CommitsByMessageResponse);
rpc GetCommitStats(GetCommitStatsRequest) returns (CommitStats);
rpc LastCommitForPath(LastCommitForPathRequest) returns (LastCommitForPathResponse);
rpc CountCommits(CountCommitsRequest) returns (CountCommitsResponse);
rpc CountDivergingCommits(CountDivergingCommitsRequest) returns (CountDivergingCommitsResponse);
}