patch

package
v0.0.0-...-900fa13 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Collection = "patches"
)

Variables

View Source
var (
	IdKey            = bsonutil.MustHaveTag(Patch{}, "Id")
	DescriptionKey   = bsonutil.MustHaveTag(Patch{}, "Description")
	ProjectKey       = bsonutil.MustHaveTag(Patch{}, "Project")
	GithashKey       = bsonutil.MustHaveTag(Patch{}, "Githash")
	AuthorKey        = bsonutil.MustHaveTag(Patch{}, "Author")
	NumberKey        = bsonutil.MustHaveTag(Patch{}, "PatchNumber")
	VersionKey       = bsonutil.MustHaveTag(Patch{}, "Version")
	StatusKey        = bsonutil.MustHaveTag(Patch{}, "Status")
	CreateTimeKey    = bsonutil.MustHaveTag(Patch{}, "CreateTime")
	StartTimeKey     = bsonutil.MustHaveTag(Patch{}, "StartTime")
	FinishTimeKey    = bsonutil.MustHaveTag(Patch{}, "FinishTime")
	BuildVariantsKey = bsonutil.MustHaveTag(Patch{}, "BuildVariants")
	TasksKey         = bsonutil.MustHaveTag(Patch{}, "Tasks")
	PatchesKey       = bsonutil.MustHaveTag(Patch{}, "Patches")
	ActivatedKey     = bsonutil.MustHaveTag(Patch{}, "Activated")
	PatchedConfigKey = bsonutil.MustHaveTag(Patch{}, "PatchedConfig")

	// BSON fields for the module patch struct
	ModulePatchNameKey    = bsonutil.MustHaveTag(ModulePatch{}, "ModuleName")
	ModulePatchGithashKey = bsonutil.MustHaveTag(ModulePatch{}, "Githash")
	ModulePatchSetKey     = bsonutil.MustHaveTag(ModulePatch{}, "PatchSet")

	// BSON fields for the patch set struct
	PatchSetPatchKey   = bsonutil.MustHaveTag(PatchSet{}, "Patch")
	PatchSetSummaryKey = bsonutil.MustHaveTag(PatchSet{}, "Summary")

	// BSON fields for the git patch summary struct
	GitSummaryNameKey      = bsonutil.MustHaveTag(thirdparty.Summary{}, "Name")
	GitSummaryAdditionsKey = bsonutil.MustHaveTag(thirdparty.Summary{}, "Additions")
	GitSummaryDeletionsKey = bsonutil.MustHaveTag(thirdparty.Summary{}, "Deletions")
)

BSON fields for the patches

View Source
var ExcludePatchDiff = bson.D{
	{PatchesKey + "." + ModulePatchSetKey + "." + PatchSetPatchKey, 0},
}

ExcludePatchDiff is a projection that excludes diff data, helping load times.

Functions

func ById

func ById(id bson.ObjectId) db.Q

ById produces a query to return the patch with the given _id.

func ByProject

func ByProject(project string) db.Q

ByProject produces a query that returns projects with the given identifier.

func ByUser

func ByUser(user string) db.Q

ByUser produces a query that returns patches by the given user.

func ByUserProjectAndGitspec

func ByUserProjectAndGitspec(user string, project string, gitspec string) db.Q

ByUserProjectAndGitspec produces a query that returns patches by the given patch author, project, and gitspec.

func ByVersion

func ByVersion(version string) db.Q

ByUser produces a query that returns the patch for a given version.

func Count

func Count(query db.Q) (int, error)

Count returns the number of patches that satisfy the given query.

func IsValidId

func IsValidId(id string) bool

IsValidId returns whether the supplied Id is a valid patch doc id (BSON ObjectId).

func NewId

func NewId(id string) bson.ObjectId

NewId constructs a valid patch Id from the given hex string.

func Remove

func Remove(query db.Q) error

Remove removes all patch documents that satisfy the query.

func TryMarkFinished

func TryMarkFinished(versionId string, finishTime time.Time, status string) error

TryMarkFinished attempts to mark a patch of a given version as finished.

func TryMarkStarted

func TryMarkStarted(versionId string, startTime time.Time) error

TryMarkStarted attempts to mark a patch as started if it isn't already marked as such

func UpdateAll

func UpdateAll(query interface{}, update interface{}) (info *mgo.ChangeInfo, err error)

UpdateAll runs an update on all patch documents.

func UpdateOne

func UpdateOne(query interface{}, update interface{}) error

UpdateOne runs an update on a single patch document.

Types

type ModulePatch

type ModulePatch struct {
	ModuleName string   `bson:"name"`
	Githash    string   `bson:"githash"`
	PatchSet   PatchSet `bson:"patch_set"`
}

this stores request details for a patch

type Patch

type Patch struct {
	Id            bson.ObjectId `bson:"_id,omitempty"`
	Description   string        `bson:"desc"`
	Project       string        `bson:"branch"`
	Githash       string        `bson:"githash"`
	PatchNumber   int           `bson:"patch_number"`
	Author        string        `bson:"author"`
	Version       string        `bson:"version"`
	Status        string        `bson:"status"`
	CreateTime    time.Time     `bson:"create_time"`
	StartTime     time.Time     `bson:"start_time"`
	FinishTime    time.Time     `bson:"finish_time"`
	BuildVariants []string      `bson:"build_variants"`
	Tasks         []string      `bson:"tasks"`
	Patches       []ModulePatch `bson:"patches"`
	Activated     bool          `bson:"activated"`
	PatchedConfig string        `bson:"patched_config"`
}

Stores all details related to a patch request

func Find

func Find(query db.Q) ([]Patch, error)

Find runs a patch query, returning all patches that satisfy the query.

func FindOne

func FindOne(query db.Q) (*Patch, error)

FindOne runs a patch query, returning one patch.

func (*Patch) AddBuildVariants

func (p *Patch) AddBuildVariants(bvs []string) error

AddBuildVariants adds more buildvarints to a patch document. This is meant to be used after initial patch creation.

func (*Patch) AddTasks

func (p *Patch) AddTasks(tasks []string) error

AddTasks adds more tasks to a patch document. This is meant to be used after initial patch creation, to reconfigure the patch.

func (*Patch) ConfigChanged

func (p *Patch) ConfigChanged(remotePath string) bool

ConfigChanged looks through the parts of the patch and returns true if the passed in remotePath is in the the name of the changed files that are part of the patch

func (*Patch) Insert

func (p *Patch) Insert() error

Insert inserts the patch into the db, returning any errors that occur

func (*Patch) RemoveModulePatch

func (p *Patch) RemoveModulePatch(moduleName string) error

RemoveModulePatch removes a module that's part of a patch request

func (*Patch) SetActivated

func (p *Patch) SetActivated(versionId string) error

SetActivated sets the patch to activated in the db

func (*Patch) SetDescription

func (p *Patch) SetDescription(desc string) error

func (*Patch) SetVariantsAndTasks

func (p *Patch) SetVariantsAndTasks(variants []string,
	tasks []string) error

func (*Patch) UpdateModulePatch

func (p *Patch) UpdateModulePatch(modulePatch ModulePatch) error

Add or update a module within a patch.

type PatchSet

type PatchSet struct {
	Patch   string               `bson:"patch"`
	Summary []thirdparty.Summary `bson:"summary"`
}

this stores information about the actual patch

Jump to

Keyboard shortcuts

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