go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/common/proto/gitiles/gitiles.proto (about) 1 // Copyright 2017 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 option go_package = "go.chromium.org/luci/common/proto/gitiles"; 18 19 package gitiles; 20 21 import "go.chromium.org/luci/common/proto/git/commit.proto"; 22 23 service Gitiles { 24 // Log retrieves commit log. 25 rpc Log(LogRequest) returns (LogResponse) {}; 26 // Refs retrieves repo refs. 27 rpc Refs(RefsRequest) returns (RefsResponse) {}; 28 // Archive retrieves archived content bundle under the provided path in a 29 // repo or the entire repo if the path is not provided. 30 // 31 // Note: for a single file, use DownloadFile to obtain the plain text file. 32 rpc Archive(ArchiveRequest) returns (ArchiveResponse) {}; 33 // DownloadFile retrieves a file from the project. 34 rpc DownloadFile(DownloadFileRequest) returns (DownloadFileResponse) {}; 35 // DownloadDiff retrives a diff of a revision from the project. 36 rpc DownloadDiff(DownloadDiffRequest) returns (DownloadDiffResponse) {}; 37 // Projects retrieves list of available Gitiles projects. 38 rpc Projects(ProjectsRequest) returns (ProjectsResponse) {}; 39 // ListFiles retrieves a list of files at the given revision. 40 rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) {}; 41 } 42 43 // LogRequest is request message for Gitiles.Log rpc. 44 message LogRequest { 45 // Gitiles project, e.g. "chromium/src" part in 46 // https://chromium.googlesource.com/chromium/src/+/main 47 // Required. 48 string project = 1; 49 // The commit where to start the listing from. 50 // The value can be: 51 // - a git revision as 40-char string or its prefix so long as its unique in repo. 52 // - a ref such as "refs/heads/branch" 53 // - a ref defined as n-th parent of R in the form "R~n". 54 // For example, "main~2" or "deadbeef~1". 55 // Required. 56 string committish = 3; 57 // If specified, only commits not reachable from this commit (inclusive) 58 // will be returned. 59 // 60 // In git's notation, this is 61 // $ git log ^exclude_ancestors_of committish 62 // OR 63 // $ git log exclude_ancestors_of..committish 64 // https://git-scm.com/docs/gitrevisions#gitrevisions-Theememtwo-dotRangeNotation 65 // 66 // For example, given this repo 67 // 68 // base -> A -> B -> C == refs/heads/main 69 // \ 70 // X -> Y -> Z == refs/heads/release 71 // 72 // calling Log(committish='refs/heads/release', 73 // exclude_ancestors_of='refs/heads/main') 74 // will return ['Z', Y', 'X']. 75 string exclude_ancestors_of = 2; 76 // If true, include tree diff in commits. 77 bool tree_diff = 4; 78 // If set to a non-empty value, the log will be for the given path 79 string path = 12; 80 81 // Value of next_page_token in LogResponse to continue. 82 string page_token = 10; 83 // If > 0, number of commits to retrieve. 84 int32 page_size = 11; 85 } 86 87 // LogRequest is response message for Gitiles.Log rpc. 88 message LogResponse { 89 // Retrieved commits. 90 repeated git.Commit log = 1; 91 // A page token for next LogRequest to fetch next page of commits. 92 string next_page_token = 2; 93 } 94 95 // RefsRequest is a request message of Gitiles.Refs RPC. 96 message RefsRequest { 97 // Gitiles project, e.g. "chromium/src" part in 98 // https://chromium.googlesource.com/chromium/src/+/main 99 // Required. 100 string project = 1; 101 // Limits which refs to resolve to only those matching {refsPath}/*. 102 // 103 // Must be "refs" or start with "refs/". 104 // Must not include glob '*'. 105 // Use "refs/heads" to retrieve all branches. 106 // 107 // To fetch **all** refs in a repo, specify just "refs" but beware of two 108 // caveats: 109 // * refs returned include a ref for each patchset for each Gerrit change 110 // associated with the repo. 111 // * returned map will contain special "HEAD" ref whose value in resulting map 112 // will be name of the actual ref to which "HEAD" points, which is typically 113 // "refs/heads/main". 114 // 115 // Thus, if you are looking for all tags and all branches of repo, it's 116 // recommended to issue two Refs calls limited to "refs/tags" and "refs/heads" 117 // instead of one call for "refs". 118 // 119 // Since Gerrit allows per-ref ACLs, it is possible that some refs matching 120 // refPrefix would not be present in results because current user isn't granted 121 // read permission on them. 122 string refs_path = 2; 123 } 124 125 // RefsResponse is a response message of Gitiles.Refs RPC. 126 message RefsResponse { 127 // revisions maps a ref to a revision. 128 // Git branches have keys start with "refs/heads/". 129 map<string, string> revisions = 2; 130 } 131 132 // ArchiveRequest is a request message of the Gitiles.Archive RPC. 133 message ArchiveRequest { 134 // Gitiles project, e.g. "chromium/src" part in 135 // https://chromium.googlesource.com/chromium/src/+/main 136 // Required. 137 string project = 1; 138 139 // The ref at which to generate the project archive for. 140 // 141 // viz refs/for/branch or just branch 142 string ref = 2; 143 144 // List copied from 145 // https://github.com/google/gitiles/blob/65edbe49f2b3882a5979f602383ef0c7b2b8ee0c/java/com/google/gitiles/ArchiveFormat.java 146 enum Format { 147 Invalid = 0; 148 GZIP = 1; 149 TAR = 2; 150 BZIP2 = 3; 151 XZ = 4; 152 } 153 // Format of the returned archive. 154 Format format = 3; 155 156 // POSIX style path relative to the project root. 157 // Optional. If not specified, it means to get the entire project archive. 158 string path = 4; 159 } 160 161 message ArchiveResponse { 162 // Suggested name of the returned archive. 163 string filename = 1; 164 165 // Contents of the archive streamed from gitiles. 166 // 167 // The underlying server RPC streams back the contents. This API simplifies 168 // the RPC to a non-streaming response. 169 bytes contents = 2; 170 } 171 172 message DownloadFileRequest { 173 // Gitiles project, e.g. "chromium/src" part in 174 // https://chromium.googlesource.com/chromium/src/+/main 175 // Required. 176 string project = 1; 177 178 // The commit where to start the listing from. 179 // The value can be: 180 // - a git revision as 40-char string or its prefix so long as its unique in repo. 181 // - a ref such as "refs/heads/branch" 182 // - a ref defined as n-th parent of R in the form "R~n". 183 // For example, "main~2" or "deadbeef~1". 184 // Required. 185 string committish = 2; 186 187 // Path relative to the project root to the file to download. 188 string path = 3; 189 190 reserved 4; 191 reserved "format"; 192 } 193 194 message DownloadFileResponse { 195 // Decoded contents of the downloaded file. 196 // 197 // The underlying server RPC streams back the contents. This API simplifies 198 // the RPC to a non-streaming response. 199 string contents = 1; 200 } 201 202 message DownloadDiffRequest { 203 // Gitiles project, e.g. "chromium/src" part in 204 // https://chromium.googlesource.com/chromium/src/+/main 205 // Required. 206 string project = 1; 207 208 // The git revision to get the diff at. 209 // The value can be: 210 // - a git revision as 40-char string or its prefix so long as its unique in repo. 211 // - a ref such as "refs/heads/branch" 212 // - a ref defined as n-th parent of R in the form "R~n". 213 // For example, "main~2" or "deadbeef~1". 214 // Required. 215 string committish = 2; 216 217 // The git revision to compute the diff against. 218 // The value can be: 219 // - a git revision as 40-char string or its prefix so long as its unique in repo. 220 // - a ref such as "refs/heads/branch" 221 // - a ref defined as n-th parent of R in the form "R~n". 222 // For example, "main~2" or "deadbeef~1". 223 // Optional. If not specified, the diff will be against the parent of committish. 224 string base = 4; 225 226 // Path relative to the project root to the file to limit the diff to. 227 // Optional. 228 string path = 3; 229 } 230 231 message DownloadDiffResponse { 232 // Decoded contents of the diff. 233 string contents = 1; 234 } 235 236 message ProjectsRequest { 237 } 238 239 message ProjectsResponse { 240 // List of available Gitiles projects 241 repeated string projects = 1; 242 } 243 244 message ListFilesRequest { 245 // Gitiles project, e.g. "chromium/src" part in 246 // https://chromium.googlesource.com/chromium/src/+/main 247 // Required. 248 string project = 1; 249 250 // The git revision to list files at. 251 // The value can be: 252 // - a git revision as 40-char string or its prefix so long as its unique in repo. 253 // - a ref such as "refs/heads/branch" 254 // - a ref defined as n-th parent of R in the form "R~n". 255 // For example, "main~2" or "deadbeef~1". 256 // Required. 257 string committish = 2; 258 259 // Path relative to the project root to limit the list to. Only direct 260 // children will be returned -- the request does not recursively process 261 // child directories. 262 // Optional. 263 string path = 3; 264 } 265 266 message ListFilesResponse { 267 // List of files. 268 repeated git.File files = 1; 269 }