cqdepend

package
v0.0.0-...-a70aae3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cqdepend parses CQ-Depend directives in CL description.

CQ-Depend directives are special footer lines in CL descriptions. Footers are roughly "Key: arbitrary value" lines in the last paragraph of CL description, see more at: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-footers.html

CQ-Depend footer starts with "CQ-Depend:" prefix and contains comma separated values:

CQ-Depend: VALUE[,VALUE]*

where each VALUE is:

[SUBDOMAIN:]NUMBER

where if SUBDOMAIN is specified, it is a subdomain w/o "-review" suffix of a Gerrit host, e.g., just "chrome-internal" for https://chrome-internal-review.googlesource.com Gerrit host.

For example, if a CL on chromium-review.googlesource.com has the following description:

Example CL with explicit dependencies.

This: is footer, because it is in the last paragraph.
  It may have non "key: value" lines,
  the next line says CL depends on chromium-review.googlesource.com/123.
CQ-Depend: 123
  and multiple CQ-Depend lines are allowed, such as next line saying
  this CL also depends on pdfium-review.googlesource.com/987.
CQ-Depend: pdfium:987
  Prefix is just "pdfium" and "-review" is implicitly inferred.
  For practicality, the following is not valid:
CQ-Depend: pdfium-review:456
  It's OK to specify multiple comma separated CQ-Depend values:
CQ-Depend: 123,pdfium:987

Error handling:

  • Valid CQ-Depend lines are ignored entirely if not in the last paragraph of CL's description (because they aren't Git/Gerrit footers). For example, in this description CQ-Depend is ignored:

    Title.

    CQ-Depend: valid:123 But this isn't last paragraph.

    Change-Id: Ideadbeef This-is: the last paragraph.

  • Each CQ-Depend line is parsed independently; any invalid ones are silently ignored. For example, CQ-Depend: not valid, and so it is ignored. CQ-Depend: valid:123

  • In a single CQ-Depend line, each value is processed independently, and invalid values are ignored. For example: CQ-Depend: x:123, bad, 456 will result in just 2 dependencies: "x:123" and "456".

See also Lint method, which reports all such misuses of CQ-Depend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lint

func Lint(description string) error

Lint reports warnings or errors regarding CQ-Depend use.

Types

type Dep

type Dep struct {
	// Subdomain is set if change is on a different Gerrit host.
	Subdomain string
	Change    int64
}

Dep is a Gerrit Change representing a dependency.

func Parse

func Parse(description string) (deps []Dep)

Parse returns all valid dependencies without duplicates.

Jump to

Keyboard shortcuts

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