gitiles

package
v0.0.0-...-51f9457 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package gitiles contains Gitiles service definition.

Index

Constants

View Source
const (
	// AllRefs instructs the client to fetch all refs.
	AllRefs = "refs"
	// Branches instructs the client to fetch all branches.
	Branches = "refs/heads"
	// Tags instructs the client to fetch all tags.
	Tags = "refs/tags"
)

These constants are possible values for RefsRequest.RefsPath field. Not an exhaustive list.

Variables

View Source
var (
	ArchiveRequest_Format_name = map[int32]string{
		0: "Invalid",
		1: "GZIP",
		2: "TAR",
		3: "BZIP2",
		4: "XZ",
	}
	ArchiveRequest_Format_value = map[string]int32{
		"Invalid": 0,
		"GZIP":    1,
		"TAR":     2,
		"BZIP2":   3,
		"XZ":      4,
	}
)

Enum value maps for ArchiveRequest_Format.

View Source
var (
	DownloadFileRequest_Format_name = map[int32]string{
		0: "FormatInvalid",
		1: "TEXT",
	}
	DownloadFileRequest_Format_value = map[string]int32{
		"FormatInvalid": 0,
		"TEXT":          1,
	}
)

Enum value maps for DownloadFileRequest_Format.

View Source
var File_go_chromium_org_luci_common_proto_gitiles_gitiles_proto protoreflect.FileDescriptor

Functions

func FileDescriptorSet

func FileDescriptorSet() *descriptorpb.FileDescriptorSet

FileDescriptorSet returns a descriptor set for this proto package, which includes all defined services, and all transitive dependencies.

Will not return nil.

Do NOT modify the returned descriptor.

func RegisterGitilesServer

func RegisterGitilesServer(s prpc.Registrar, srv GitilesServer)

Types

type ArchiveRequest

type ArchiveRequest struct {

	// Gitiles project, e.g. "chromium/src" part in
	// https://chromium.googlesource.com/chromium/src/+/master
	// Required.
	Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
	// The ref at which to generate the project archive for.
	//
	// viz refs/for/branch or just branch
	Ref string `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
	// Format of the returned project archive.
	Format ArchiveRequest_Format `protobuf:"varint,3,opt,name=format,proto3,enum=gitiles.ArchiveRequest_Format" json:"format,omitempty"`
	// contains filtered or unexported fields
}

ArchiveRequest is a request message of the Gitiles.Archive RPC.

func (*ArchiveRequest) Descriptor deprecated

func (*ArchiveRequest) Descriptor() ([]byte, []int)

Deprecated: Use ArchiveRequest.ProtoReflect.Descriptor instead.

func (*ArchiveRequest) GetFormat

func (x *ArchiveRequest) GetFormat() ArchiveRequest_Format

func (*ArchiveRequest) GetProject

func (x *ArchiveRequest) GetProject() string

func (*ArchiveRequest) GetRef

func (x *ArchiveRequest) GetRef() string

func (*ArchiveRequest) ProtoMessage

func (*ArchiveRequest) ProtoMessage()

func (*ArchiveRequest) ProtoReflect

func (x *ArchiveRequest) ProtoReflect() protoreflect.Message

func (*ArchiveRequest) Reset

func (x *ArchiveRequest) Reset()

func (*ArchiveRequest) String

func (x *ArchiveRequest) String() string

func (*ArchiveRequest) Validate

func (r *ArchiveRequest) Validate() error

Validate returns an error if r is invalid.

type ArchiveRequest_Format

type ArchiveRequest_Format int32

List copied from https://github.com/google/gitiles/blob/65edbe49f2b3882a5979f602383ef0c7b2b8ee0c/java/com/google/gitiles/ArchiveFormat.java

const (
	ArchiveRequest_Invalid ArchiveRequest_Format = 0
	ArchiveRequest_GZIP    ArchiveRequest_Format = 1
	ArchiveRequest_TAR     ArchiveRequest_Format = 2
	ArchiveRequest_BZIP2   ArchiveRequest_Format = 3
	ArchiveRequest_XZ      ArchiveRequest_Format = 4
)

func (ArchiveRequest_Format) Descriptor

func (ArchiveRequest_Format) Enum

func (ArchiveRequest_Format) EnumDescriptor deprecated

func (ArchiveRequest_Format) EnumDescriptor() ([]byte, []int)

Deprecated: Use ArchiveRequest_Format.Descriptor instead.

func (ArchiveRequest_Format) Number

func (ArchiveRequest_Format) String

func (x ArchiveRequest_Format) String() string

func (ArchiveRequest_Format) Type

type ArchiveResponse

type ArchiveResponse struct {

	// Suggested name of the returned archive.
	Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	// Contents of the archive streamed from gitiles.
	//
	// The underlying server RPC streams back the contents. This API simplifies
	// the RPC to a non-streaming response.
	Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"`
	// contains filtered or unexported fields
}

func (*ArchiveResponse) Descriptor deprecated

func (*ArchiveResponse) Descriptor() ([]byte, []int)

Deprecated: Use ArchiveResponse.ProtoReflect.Descriptor instead.

func (*ArchiveResponse) GetContents

func (x *ArchiveResponse) GetContents() []byte

func (*ArchiveResponse) GetFilename

func (x *ArchiveResponse) GetFilename() string

func (*ArchiveResponse) ProtoMessage

func (*ArchiveResponse) ProtoMessage()

func (*ArchiveResponse) ProtoReflect

func (x *ArchiveResponse) ProtoReflect() protoreflect.Message

func (*ArchiveResponse) Reset

func (x *ArchiveResponse) Reset()

func (*ArchiveResponse) String

func (x *ArchiveResponse) String() string

type DownloadFileRequest

type DownloadFileRequest struct {

	// Gitiles project, e.g. "chromium/src" part in
	// https://chromium.googlesource.com/chromium/src/+/master
	// Required.
	Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
	// The commit where to start the listing from.
	// The value can be:
	//   - a git revision as 40-char string or its prefix so long as its unique in repo.
	//   - a ref such as "refs/heads/branch"
	//   - a ref defined as n-th parent of R in the form "R~n".
	//     For example, "master~2" or "deadbeef~1".
	// Required.
	Committish string `protobuf:"bytes,2,opt,name=committish,proto3" json:"committish,omitempty"`
	// Path relative to the project root to the file to download.
	Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	// Format to download file in.
	Format DownloadFileRequest_Format `protobuf:"varint,4,opt,name=format,proto3,enum=gitiles.DownloadFileRequest_Format" json:"format,omitempty"`
	// contains filtered or unexported fields
}

func (*DownloadFileRequest) Descriptor deprecated

func (*DownloadFileRequest) Descriptor() ([]byte, []int)

Deprecated: Use DownloadFileRequest.ProtoReflect.Descriptor instead.

func (*DownloadFileRequest) GetCommittish

func (x *DownloadFileRequest) GetCommittish() string

func (*DownloadFileRequest) GetFormat

func (*DownloadFileRequest) GetPath

func (x *DownloadFileRequest) GetPath() string

func (*DownloadFileRequest) GetProject

func (x *DownloadFileRequest) GetProject() string

func (*DownloadFileRequest) ProtoMessage

func (*DownloadFileRequest) ProtoMessage()

func (*DownloadFileRequest) ProtoReflect

func (x *DownloadFileRequest) ProtoReflect() protoreflect.Message

func (*DownloadFileRequest) Reset

func (x *DownloadFileRequest) Reset()

func (*DownloadFileRequest) String

func (x *DownloadFileRequest) String() string

func (*DownloadFileRequest) Validate

func (r *DownloadFileRequest) Validate() error

Validate returns an error if r is invalid.

type DownloadFileRequest_Format

type DownloadFileRequest_Format int32
const (
	DownloadFileRequest_FormatInvalid DownloadFileRequest_Format = 0
	DownloadFileRequest_TEXT          DownloadFileRequest_Format = 1
)

func (DownloadFileRequest_Format) Descriptor

func (DownloadFileRequest_Format) Enum

func (DownloadFileRequest_Format) EnumDescriptor deprecated

func (DownloadFileRequest_Format) EnumDescriptor() ([]byte, []int)

Deprecated: Use DownloadFileRequest_Format.Descriptor instead.

func (DownloadFileRequest_Format) Number

func (DownloadFileRequest_Format) String

func (DownloadFileRequest_Format) Type

type DownloadFileResponse

type DownloadFileResponse struct {

	// Decoded contents of the downloaded file.
	//
	// The underlying server RPC streams back the contents. This API simplifies
	// the RPC to a non-streaming response.
	Contents string `protobuf:"bytes,1,opt,name=contents,proto3" json:"contents,omitempty"`
	// contains filtered or unexported fields
}

func (*DownloadFileResponse) Descriptor deprecated

func (*DownloadFileResponse) Descriptor() ([]byte, []int)

Deprecated: Use DownloadFileResponse.ProtoReflect.Descriptor instead.

func (*DownloadFileResponse) GetContents

func (x *DownloadFileResponse) GetContents() string

func (*DownloadFileResponse) ProtoMessage

func (*DownloadFileResponse) ProtoMessage()

func (*DownloadFileResponse) ProtoReflect

func (x *DownloadFileResponse) ProtoReflect() protoreflect.Message

func (*DownloadFileResponse) Reset

func (x *DownloadFileResponse) Reset()

func (*DownloadFileResponse) String

func (x *DownloadFileResponse) String() string

type Fake

type Fake struct {
	// contains filtered or unexported fields
}

Fake allows testing of Gitiles API without using actual Gitiles server. User can set data using SetRepository method.

func (*Fake) Archive

func (f *Fake) Archive(ctx context.Context, in *ArchiveRequest, opts ...grpc.CallOption) (*ArchiveResponse, error)

Archive retrieves archived contents of the project. This is not implemented.

An archive is a shallow bundle of the contents of a repository.

DEPRECATED: Use DownloadFile to obtain plain text files. TODO(pprabhu): Migrate known users to DownloadFile and delete this RPC.

func (*Fake) DownloadFile

func (f *Fake) DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (*DownloadFileResponse, error)

DownloadFile retrieves a file from the project. This is not implemented.

func (*Fake) GetCallLogs

func (f *Fake) GetCallLogs() []interface{}

GetCallLogs returns callLogs.

func (*Fake) Log

func (f *Fake) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*LogResponse, error)

Log retrieves commit log. Merge commits are supported, but it implements simple logic and likely won't return results in the same order as Gitiles.

func (*Fake) Projects

func (f *Fake) Projects(ctx context.Context, in *ProjectsRequest, opts ...grpc.CallOption) (*ProjectsResponse, error)

Projects retrieves list of available Gitiles projects

func (*Fake) Refs

func (f *Fake) Refs(ctx context.Context, in *RefsRequest, opts ...grpc.CallOption) (*RefsResponse, error)

Refs retrieves repo refs.

func (*Fake) SetRepository

func (f *Fake) SetRepository(repository string, refs map[string]string, commits []*git.Commit)

SetRepository stores provided references and commits to desired repository. If repository is previously set, it will override it.

refs keys are references, keys are revisions. Example: f.SetRepository(

"foo",
[]string{"refs/heads/master", "rev1"},
[]*git.Commit{ {Id: "rev1", Parents: []string{"rev0"}}, {Id: "rev0"} }

) Represents following repository: name: foo references: * refs/heads/master points to rev1 commits: rev1 --> rev0 (root commit)

type GitilesClient

type GitilesClient interface {
	// Log retrieves commit log.
	Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*LogResponse, error)
	// Refs retrieves repo refs.
	Refs(ctx context.Context, in *RefsRequest, opts ...grpc.CallOption) (*RefsResponse, error)
	// Archive retrieves archived contents of the project.
	//
	// An archive is a shallow bundle of the contents of a repository.
	//
	// DEPRECATED: Use DownloadFile to obtain plain text files.
	// TODO(pprabhu): Migrate known users to DownloadFile and delete this RPC.
	Archive(ctx context.Context, in *ArchiveRequest, opts ...grpc.CallOption) (*ArchiveResponse, error)
	// DownloadFile retrieves a file from the project.
	DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (*DownloadFileResponse, error)
	// Projects retrieves list of available Gitiles projects
	Projects(ctx context.Context, in *ProjectsRequest, opts ...grpc.CallOption) (*ProjectsResponse, error)
}

GitilesClient is the client API for Gitiles service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewGitilesClient

func NewGitilesClient(cc grpc.ClientConnInterface) GitilesClient

func NewGitilesPRPCClient

func NewGitilesPRPCClient(client *prpc.Client) GitilesClient

type GitilesServer

type GitilesServer interface {
	// Log retrieves commit log.
	Log(context.Context, *LogRequest) (*LogResponse, error)
	// Refs retrieves repo refs.
	Refs(context.Context, *RefsRequest) (*RefsResponse, error)
	// Archive retrieves archived contents of the project.
	//
	// An archive is a shallow bundle of the contents of a repository.
	//
	// DEPRECATED: Use DownloadFile to obtain plain text files.
	// TODO(pprabhu): Migrate known users to DownloadFile and delete this RPC.
	Archive(context.Context, *ArchiveRequest) (*ArchiveResponse, error)
	// DownloadFile retrieves a file from the project.
	DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileResponse, error)
	// Projects retrieves list of available Gitiles projects
	Projects(context.Context, *ProjectsRequest) (*ProjectsResponse, error)
}

GitilesServer is the server API for Gitiles service.

type LogRequest

type LogRequest struct {

	// Gitiles project, e.g. "chromium/src" part in
	// https://chromium.googlesource.com/chromium/src/+/master
	// Required.
	Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
	// The commit where to start the listing from.
	// The value can be:
	//   - a git revision as 40-char string or its prefix so long as its unique in repo.
	//   - a ref such as "refs/heads/branch"
	//   - a ref defined as n-th parent of R in the form "R~n".
	//     For example, "master~2" or "deadbeef~1".
	// Required.
	Committish string `protobuf:"bytes,3,opt,name=committish,proto3" json:"committish,omitempty"`
	// If specified, only commits not reachable from this commit (inclusive)
	// will be returned.
	//
	// In git's notation, this is
	//   $ git log ^exclude_ancestors_of committish
	//  OR
	//   $ git log exclude_ancestors_of..committish
	// https://git-scm.com/docs/gitrevisions#gitrevisions-Theememtwo-dotRangeNotation
	//
	// For example, given this repo
	//
	//     base -> A -> B -> C == refs/heads/master
	//        \
	//         X -> Y -> Z  == refs/heads/release
	//
	// calling Log(committish='refs/heads/release',
	//             exclude_ancestors_of='refs/heads/master')
	// will return ['Z', Y', 'X'].
	ExcludeAncestorsOf string `protobuf:"bytes,2,opt,name=exclude_ancestors_of,json=excludeAncestorsOf,proto3" json:"exclude_ancestors_of,omitempty"`
	// If true, include tree diff in commits.
	TreeDiff bool `protobuf:"varint,4,opt,name=tree_diff,json=treeDiff,proto3" json:"tree_diff,omitempty"`
	// Value of next_page_token in LogResponse to continue.
	PageToken string `protobuf:"bytes,10,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	// If > 0, number of commits to retrieve.
	PageSize int32 `protobuf:"varint,11,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// contains filtered or unexported fields
}

LogRequest is request message for Gitiles.Log rpc.

func (*LogRequest) Descriptor deprecated

func (*LogRequest) Descriptor() ([]byte, []int)

Deprecated: Use LogRequest.ProtoReflect.Descriptor instead.

func (*LogRequest) GetCommittish

func (x *LogRequest) GetCommittish() string

func (*LogRequest) GetExcludeAncestorsOf

func (x *LogRequest) GetExcludeAncestorsOf() string

func (*LogRequest) GetPageSize

func (x *LogRequest) GetPageSize() int32

func (*LogRequest) GetPageToken

func (x *LogRequest) GetPageToken() string

func (*LogRequest) GetProject

func (x *LogRequest) GetProject() string

func (*LogRequest) GetTreeDiff

func (x *LogRequest) GetTreeDiff() bool

func (*LogRequest) ProtoMessage

func (*LogRequest) ProtoMessage()

func (*LogRequest) ProtoReflect

func (x *LogRequest) ProtoReflect() protoreflect.Message

func (*LogRequest) Reset

func (x *LogRequest) Reset()

func (*LogRequest) String

func (x *LogRequest) String() string

func (*LogRequest) Validate

func (r *LogRequest) Validate() error

Validate returns an error if r is invalid.

type LogResponse

type LogResponse struct {

	// Retrieved commits.
	Log []*git.Commit `protobuf:"bytes,1,rep,name=log,proto3" json:"log,omitempty"`
	// A page token for next LogRequest to fetch next page of commits.
	NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

LogRequest is response message for Gitiles.Log rpc.

func (*LogResponse) Descriptor deprecated

func (*LogResponse) Descriptor() ([]byte, []int)

Deprecated: Use LogResponse.ProtoReflect.Descriptor instead.

func (*LogResponse) GetLog

func (x *LogResponse) GetLog() []*git.Commit

func (*LogResponse) GetNextPageToken

func (x *LogResponse) GetNextPageToken() string

func (*LogResponse) ProtoMessage

func (*LogResponse) ProtoMessage()

func (*LogResponse) ProtoReflect

func (x *LogResponse) ProtoReflect() protoreflect.Message

func (*LogResponse) Reset

func (x *LogResponse) Reset()

func (*LogResponse) String

func (x *LogResponse) String() string

type ProjectsRequest

type ProjectsRequest struct {
	// contains filtered or unexported fields
}

func (*ProjectsRequest) Descriptor deprecated

func (*ProjectsRequest) Descriptor() ([]byte, []int)

Deprecated: Use ProjectsRequest.ProtoReflect.Descriptor instead.

func (*ProjectsRequest) ProtoMessage

func (*ProjectsRequest) ProtoMessage()

func (*ProjectsRequest) ProtoReflect

func (x *ProjectsRequest) ProtoReflect() protoreflect.Message

func (*ProjectsRequest) Reset

func (x *ProjectsRequest) Reset()

func (*ProjectsRequest) String

func (x *ProjectsRequest) String() string

type ProjectsResponse

type ProjectsResponse struct {

	// List of available Gitiles projects
	Projects []string `protobuf:"bytes,1,rep,name=projects,proto3" json:"projects,omitempty"`
	// contains filtered or unexported fields
}

func (*ProjectsResponse) Descriptor deprecated

func (*ProjectsResponse) Descriptor() ([]byte, []int)

Deprecated: Use ProjectsResponse.ProtoReflect.Descriptor instead.

func (*ProjectsResponse) GetProjects

func (x *ProjectsResponse) GetProjects() []string

func (*ProjectsResponse) ProtoMessage

func (*ProjectsResponse) ProtoMessage()

func (*ProjectsResponse) ProtoReflect

func (x *ProjectsResponse) ProtoReflect() protoreflect.Message

func (*ProjectsResponse) Reset

func (x *ProjectsResponse) Reset()

func (*ProjectsResponse) String

func (x *ProjectsResponse) String() string

type RefsRequest

type RefsRequest struct {

	// Gitiles project, e.g. "chromium/src" part in
	// https://chromium.googlesource.com/chromium/src/+/master
	// Required.
	Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
	// Limits which refs to resolve to only those matching {refsPath}/*.
	//
	// Must be "refs" or start with "refs/".
	// Must not include glob '*'.
	// Use "refs/heads" to retrieve all branches.
	//
	// To fetch **all** refs in a repo, specify just "refs" but beware of two
	// caveats:
	//  * refs returned include a ref for each patchset for each Gerrit change
	//    associated with the repo.
	//  * returned map will contain special "HEAD" ref whose value in resulting map
	//    will be name of the actual ref to which "HEAD" points, which is typically
	//    "refs/heads/master".
	//
	// Thus, if you are looking for all tags and all branches of repo, it's
	// recommended to issue two Refs calls limited to "refs/tags" and "refs/heads"
	// instead of one call for "refs".
	//
	// Since Gerrit allows per-ref ACLs, it is possible that some refs matching
	// refPrefix would not be present in results because current user isn't granted
	// read permission on them.
	RefsPath string `protobuf:"bytes,2,opt,name=refs_path,json=refsPath,proto3" json:"refs_path,omitempty"`
	// contains filtered or unexported fields
}

RefsRequest is a request message of Gitiles.Refs RPC.

func (*RefsRequest) Descriptor deprecated

func (*RefsRequest) Descriptor() ([]byte, []int)

Deprecated: Use RefsRequest.ProtoReflect.Descriptor instead.

func (*RefsRequest) GetProject

func (x *RefsRequest) GetProject() string

func (*RefsRequest) GetRefsPath

func (x *RefsRequest) GetRefsPath() string

func (*RefsRequest) ProtoMessage

func (*RefsRequest) ProtoMessage()

func (*RefsRequest) ProtoReflect

func (x *RefsRequest) ProtoReflect() protoreflect.Message

func (*RefsRequest) Reset

func (x *RefsRequest) Reset()

func (*RefsRequest) String

func (x *RefsRequest) String() string

func (*RefsRequest) Validate

func (r *RefsRequest) Validate() error

Validate returns an error if r is invalid.

type RefsResponse

type RefsResponse struct {

	// revisions maps a ref to a revision.
	// Git branches have keys start with "refs/heads/".
	Revisions map[string]string `` /* 159-byte string literal not displayed */
	// contains filtered or unexported fields
}

RefsResponse is a response message of Gitiles.Refs RPC.

func (*RefsResponse) Descriptor deprecated

func (*RefsResponse) Descriptor() ([]byte, []int)

Deprecated: Use RefsResponse.ProtoReflect.Descriptor instead.

func (*RefsResponse) GetRevisions

func (x *RefsResponse) GetRevisions() map[string]string

func (*RefsResponse) ProtoMessage

func (*RefsResponse) ProtoMessage()

func (*RefsResponse) ProtoReflect

func (x *RefsResponse) ProtoReflect() protoreflect.Message

func (*RefsResponse) Reset

func (x *RefsResponse) Reset()

func (*RefsResponse) String

func (x *RefsResponse) String() string

type UnimplementedGitilesServer

type UnimplementedGitilesServer struct {
}

UnimplementedGitilesServer can be embedded to have forward compatible implementations.

func (*UnimplementedGitilesServer) Archive

func (*UnimplementedGitilesServer) DownloadFile

func (*UnimplementedGitilesServer) Log

func (*UnimplementedGitilesServer) Projects

func (*UnimplementedGitilesServer) Refs

Directories

Path Synopsis
Package mock_gitiles is a generated GoMock package.
Package mock_gitiles is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL