feat: init

This commit is contained in:
zhenyi
2026-06-07 11:30:56 +08:00
commit 563381c1ca
361 changed files with 41327 additions and 0 deletions
+139
View File
@@ -0,0 +1,139 @@
syntax = "proto3";
package gitks;
import "commit.proto";
import "diff.proto";
import "oid.proto";
import "repository.proto";
import "tagger.proto";
message MergeOptions {
enum Strategy {
MERGE_STRATEGY_UNSPECIFIED = 0;
MERGE_STRATEGY_RECURSIVE = 1;
MERGE_STRATEGY_ORT = 2;
MERGE_STRATEGY_RESOLVE = 3;
MERGE_STRATEGY_OCTOPUS = 4;
MERGE_STRATEGY_OURS = 5;
MERGE_STRATEGY_SUBTREE = 6;
}
enum FastForwardMode {
MERGE_FAST_FORWARD_MODE_UNSPECIFIED = 0;
MERGE_FAST_FORWARD_MODE_ALLOWED = 1;
MERGE_FAST_FORWARD_MODE_ONLY = 2;
MERGE_FAST_FORWARD_MODE_NO_FF = 3;
}
Strategy strategy = 1;
FastForwardMode fast_forward = 2;
bool squash = 3;
bool no_commit = 4;
bool allow_unrelated_histories = 5;
repeated string strategy_options = 6;
}
message MergeConflictSection {
string label = 1;
bytes content = 2;
}
message MergeConflict {
string path = 1;
uint32 mode = 2;
Oid base_oid = 3;
Oid ours_oid = 4;
Oid theirs_oid = 5;
repeated MergeConflictSection sections = 6;
bool binary = 7;
}
message MergeResult {
enum Status {
MERGE_RESULT_STATUS_UNSPECIFIED = 0;
MERGE_RESULT_STATUS_MERGED = 1;
MERGE_RESULT_STATUS_FAST_FORWARD = 2;
MERGE_RESULT_STATUS_ALREADY_UP_TO_DATE = 3;
MERGE_RESULT_STATUS_CONFLICTS = 4;
MERGE_RESULT_STATUS_ABORTED = 5;
}
Status status = 1;
Commit commit = 2;
Oid merge_base = 3;
repeated MergeConflict conflicts = 4;
DiffStats stats = 5;
string message = 6;
}
message MergeRequest {
RepositoryHeader repository = 1;
string target_branch = 2;
ObjectSelector source = 3;
Signature committer = 4;
string message = 5;
MergeOptions options = 6;
}
message CheckMergeRequest {
RepositoryHeader repository = 1;
ObjectSelector target = 2;
ObjectSelector source = 3;
MergeOptions options = 4;
}
message ListMergeConflictsRequest {
RepositoryHeader repository = 1;
ObjectSelector target = 2;
ObjectSelector source = 3;
Pagination pagination = 4;
}
message ListMergeConflictsResponse {
repeated MergeConflict conflicts = 1;
PageInfo page_info = 2;
}
message ResolveMergeConflict {
string path = 1;
bytes content = 2;
}
message ResolveMergeConflictsRequest {
RepositoryHeader repository = 1;
string target_branch = 2;
ObjectSelector source = 3;
repeated ResolveMergeConflict resolutions = 4;
Signature committer = 5;
string message = 6;
}
message RebaseRequest {
RepositoryHeader repository = 1;
string branch = 2;
ObjectSelector upstream = 3;
Signature committer = 4;
}
message RebaseResult {
enum Status {
REBASE_RESULT_STATUS_UNSPECIFIED = 0;
REBASE_RESULT_STATUS_REBASED = 1;
REBASE_RESULT_STATUS_ALREADY_UP_TO_DATE = 2;
REBASE_RESULT_STATUS_CONFLICTS = 3;
REBASE_RESULT_STATUS_ABORTED = 4;
}
Status status = 1;
Commit head = 2;
repeated MergeConflict conflicts = 3;
}
service MergeService {
rpc CheckMerge(CheckMergeRequest) returns (MergeResult);
rpc Merge(MergeRequest) returns (MergeResult);
rpc ListMergeConflicts(ListMergeConflictsRequest) returns (ListMergeConflictsResponse);
rpc ResolveMergeConflicts(ResolveMergeConflictsRequest) returns (MergeResult);
rpc Rebase(RebaseRequest) returns (RebaseResult);
}