gitdataai/lib/git/proto/diff.proto
2026-05-30 01:38:40 +08:00

174 lines
4.0 KiB
Protocol Buffer

syntax = "proto3";
package git.v1;
import "common.proto";
// Mirrors: cmd/diff/mod.rs — DiffDeltaStatus
enum DiffDeltaStatus {
DIFF_DELTA_STATUS_UNMODIFIED = 0;
DIFF_DELTA_STATUS_ADDED = 1;
DIFF_DELTA_STATUS_DELETED = 2;
DIFF_DELTA_STATUS_MODIFIED = 3;
DIFF_DELTA_STATUS_RENAMED = 4;
DIFF_DELTA_STATUS_COPIED = 5;
DIFF_DELTA_STATUS_TYPECHANGE = 6;
DIFF_DELTA_STATUS_CONFLICTED = 7;
}
// Mirrors: cmd/diff/mod.rs — DiffFile
message DiffFile {
ObjectId oid = 1;
optional string path = 2;
uint64 size = 3;
bool is_binary = 4;
}
// Mirrors: cmd/diff/mod.rs — DiffHunk
message DiffHunk {
uint32 old_start = 1;
uint32 old_lines = 2;
uint32 new_start = 3;
uint32 new_lines = 4;
string header = 5;
}
// Mirrors: cmd/diff/mod.rs — DiffDelta
message DiffDelta {
DiffDeltaStatus status = 1;
DiffFile old_file = 2;
DiffFile new_file = 3;
uint32 nfiles = 4;
repeated DiffHunk hunks = 5;
repeated DiffLine lines = 6;
}
// Mirrors: cmd/diff/mod.rs — DiffLine
message DiffLine {
string content = 1;
string origin = 2;
optional uint32 old_lineno = 3;
optional uint32 new_lineno = 4;
uint32 num_lines = 5;
int64 content_offset = 6;
}
// Mirrors: cmd/diff/mod.rs — DiffStats
message DiffStats {
uint64 files_changed = 1;
uint64 insertions = 2;
uint64 deletions = 3;
}
// Mirrors: cmd/diff/mod.rs — DiffResult
message DiffResult {
DiffStats stats = 1;
repeated DiffDelta deltas = 2;
}
// Mirrors: cmd/diff/mod.rs — DiffOptions
message DiffOptions {
uint32 context_lines = 1;
repeated string pathspec = 2;
bool ignore_whitespace = 3;
bool force_text = 4;
bool reverse = 5;
}
// Mirrors: cmd/diff/mod.rs — SideBySideChangeType
enum SideBySideChangeType {
SIDE_BY_SIDE_CHANGE_TYPE_UNCHANGED = 0;
SIDE_BY_SIDE_CHANGE_TYPE_ADDED = 1;
SIDE_BY_SIDE_CHANGE_TYPE_REMOVED = 2;
SIDE_BY_SIDE_CHANGE_TYPE_MODIFIED = 3;
SIDE_BY_SIDE_CHANGE_TYPE_EMPTY = 4;
}
// Mirrors: cmd/diff/mod.rs — SideBySideLine
message SideBySideLine {
optional uint32 left_line_no = 1;
optional uint32 right_line_no = 2;
string left_content = 3;
string right_content = 4;
SideBySideChangeType change_type = 5;
}
// Mirrors: cmd/diff/mod.rs — SideBySideFile
message SideBySideFile {
string path = 1;
uint64 additions = 2;
uint64 deletions = 3;
bool is_binary = 4;
bool is_rename = 5;
repeated SideBySideLine lines = 6;
}
// Mirrors: cmd/diff/mod.rs — SideBySideDiffResult
message SideBySideDiffResult {
repeated SideBySideFile files = 1;
uint64 total_additions = 2;
uint64 total_deletions = 3;
}
message DiffStatsRequest {
string repo_id = 1;
ObjectId old_oid = 2;
ObjectId new_oid = 3;
optional DiffOptions options = 4;
}
message DiffStatsResponse {
DiffResult result = 1;
}
message DiffPatchRequest {
string repo_id = 1;
ObjectId old_oid = 2;
ObjectId new_oid = 3;
optional DiffOptions options = 4;
}
message DiffPatchResponse {
DiffResult result = 1;
}
message DiffPatchSideBySideRequest {
string repo_id = 1;
ObjectId old_oid = 2;
ObjectId new_oid = 3;
optional DiffOptions options = 4;
}
message DiffPatchSideBySideResponse {
SideBySideDiffResult result = 1;
}
message DiffTreeToTreeRequest {
string repo_id = 1;
ObjectId old_tree = 2;
ObjectId new_tree = 3;
optional DiffOptions options = 4;
}
message DiffTreeToTreeResponse {
DiffResult result = 1;
}
message DiffIndexToTreeRequest {
string repo_id = 1;
ObjectId tree_oid = 2;
optional DiffOptions options = 3;
}
message DiffIndexToTreeResponse {
DiffResult result = 1;
}
service DiffService {
rpc DiffStats(DiffStatsRequest) returns (DiffStatsResponse);
rpc DiffPatch(DiffPatchRequest) returns (DiffPatchResponse);
rpc DiffStream(DiffPatchRequest) returns (stream DiffDelta);
rpc DiffPatchSideBySide(DiffPatchSideBySideRequest) returns (DiffPatchSideBySideResponse);
rpc DiffTreeToTree(DiffTreeToTreeRequest) returns (DiffTreeToTreeResponse);
rpc DiffIndexToTree(DiffIndexToTreeRequest) returns (DiffIndexToTreeResponse);
}