syntax = "proto3"; package gitks; import "google/protobuf/empty.proto"; import "commit.proto"; import "oid.proto"; import "repository.proto"; message BranchUpstream { string remote_name = 1; string remote_url = 2; string remote_branch_name = 3; string local_branch_name = 4; } message Branch { string name = 1; string full_ref = 2; Oid target_oid = 3; Commit commit = 4; BranchUpstream upstream = 5; bool is_default = 6; bool is_head = 7; bool is_merged = 8; bool is_detached = 9; } // Backward-compatible payload name used by earlier clients. message PayloadBranch { PayloadCommit commit = 1; string name = 2; BranchUpstream upstream = 3; bool is_head = 4; } message RequestBranchInit {} message ListBranchesRequest { RepositoryHeader repository = 1; string pattern = 2; bool merged_into_head = 3; bool not_merged_into_head = 4; Pagination pagination = 5; SortDirection sort_direction = 6; } message ListBranchesResponse { repeated Branch branches = 1; PageInfo page_info = 2; } message GetBranchRequest { RepositoryHeader repository = 1; string name = 2; } message CreateBranchRequest { RepositoryHeader repository = 1; string name = 2; ObjectSelector start_point = 3; bool force = 4; } message DeleteBranchRequest { RepositoryHeader repository = 1; string name = 2; bool force = 3; } message RenameBranchRequest { RepositoryHeader repository = 1; string old_name = 2; string new_name = 3; } message UpdateBranchTargetRequest { RepositoryHeader repository = 1; string name = 2; Oid expected_old_oid = 3; Oid new_oid = 4; bool force = 5; } message SetBranchUpstreamRequest { RepositoryHeader repository = 1; string name = 2; BranchUpstream upstream = 3; } message CompareBranchRequest { RepositoryHeader repository = 1; string source_branch = 2; string target_branch = 3; } message CompareBranchResponse { bool ahead = 1; bool behind = 2; uint32 ahead_by = 3; uint32 behind_by = 4; Oid merge_base = 5; } service BranchService { rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse); rpc GetBranch(GetBranchRequest) returns (Branch); rpc CreateBranch(CreateBranchRequest) returns (Branch); rpc DeleteBranch(DeleteBranchRequest) returns (google.protobuf.Empty); rpc RenameBranch(RenameBranchRequest) returns (Branch); rpc UpdateBranchTarget(UpdateBranchTargetRequest) returns (Branch); rpc SetBranchUpstream(SetBranchUpstreamRequest) returns (Branch); rpc CompareBranch(CompareBranchRequest) returns (CompareBranchResponse); }