Back to godoc.org

Package gerrit

v0.0.0-...-234f073
Latest Go to latest

The latest major version is .

Published: Aug 21, 2020 | License: BSD-3-Clause | Module: go.chromium.org/chromiumos/infra/go

Overview

Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Variables

var (
	// Override this to use a mock GitilesClient rather than the real one.
	MockGitiles gitilespb.GitilesClient
)

func DownloadFileFromGitiles

func DownloadFileFromGitiles(authedClient *http.Client, ctx context.Context, host, project, ref string, path string) (string, error)

DownloadFileFromGitiles downloads a file from Gitiles.

func FetchFilesFromGitiles

func FetchFilesFromGitiles(authedClient *http.Client, ctx context.Context, host, project, ref string, paths []string) (*map[string]string, error)

FetchFilesFromGitiles fetches file contents from gitiles.

project is the git project to fetch from. ref is the git-ref to fetch from. paths lists the paths inside the git project to fetch contents for.

fetchFilesFromGitiles returns a map from path in the git project to the contents of the file at that path for each requested path.

type ChangeRev

type ChangeRev struct {
	ChangeRevKey
	Project string
	Branch  string
	Files   []string
}

ChangeRev contains data about a Gerrit change,revision pair.

func GetChangeRev

func GetChangeRev(authedClient *http.Client, ctx context.Context, changeNum int64, revision int32, host string) (*ChangeRev, error)

GetChangeRev gets details from Gerrit about a change,revision pair.

type ChangeRevData

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

ChangeRevData encapsulates a bunch of Gerrit change revisions.

func GetChangeRevData

func GetChangeRevData(authedClient *http.Client, ctx context.Context, changeIds []ChangeRevKey) (*ChangeRevData, error)

GetChangeRevData fetches the Gerrit changes for the provided ChangeIdKeys, and bundles the result into a ChangeRevData.

func GetChangeRevsForTest

func GetChangeRevsForTest(cr []*ChangeRev) *ChangeRevData

GetChangeRevForTest is intended for testing only, and it allows creation of a ChangeRevData through the supplied ChangeRevs.

func (ChangeRevData) GetChangeRev

func (crv ChangeRevData) GetChangeRev(host string, changeNum int64, revision int32) (*ChangeRev, error)

GetChangeRev extracts a single Gerrit change revision from the ChangeRevData.

type ChangeRevKey

type ChangeRevKey struct {
	Host      string
	ChangeNum int64
	Revision  int32
}

ChangeRevKey is the necessary set of data for looking up a single Gerrit revision.

func (ChangeRevKey) String

func (cik ChangeRevKey) String() string

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier