git

package
v0.0.0-...-3f67607 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCloneTimeout = 2 * time.Minute
	CheckPushTag        = "flux-write-check"
)

Variables

View Source
var (
	ErrNoChanges = errors.New("no changes made in repo")
)
View Source
var NoRepoError = &fluxerr.Error{
	Type: fluxerr.User,
	Err:  errors.New("no repo in user config"),
	Help: `No Git repository URL in your config

We need to clone a git repo to proceed, and you haven't supplied
one. Please upload a config file, including a git repository URL, as
described in

    https://github.com/weaveworks/flux/blob/master/site/using.md

`,
}

Functions

func CloningError

func CloningError(url string, actual error) error

func ErrUpstreamNotWritable

func ErrUpstreamNotWritable(url string, actual error) error

func PushError

func PushError(url string, actual error) error

Types

type Checkout

type Checkout struct {
	Dir string
	Config

	sync.RWMutex
	// contains filtered or unexported fields
}

Checkout is a local clone of the remote repo.

func (*Checkout) ChangedFiles

func (c *Checkout) ChangedFiles(ctx context.Context, ref string) ([]string, error)

ChangedFiles does a git diff listing changed files

func (*Checkout) CheckOriginWritable

func (c *Checkout) CheckOriginWritable(ctx context.Context) error

CheckOriginWritable tests that we can write to the origin repository; we need to be able to do this to push the sync tag, for example.

func (*Checkout) Clean

func (c *Checkout) Clean()

Clean a Checkout up (remove the clone)

func (*Checkout) CommitAndPush

func (c *Checkout) CommitAndPush(ctx context.Context, commitAction *CommitAction, note *Note) error

CommitAndPush commits changes made in this checkout, along with any extra data as a note, and pushes the commit and note to the remote repo.

func (*Checkout) CommitsBefore

func (c *Checkout) CommitsBefore(ctx context.Context, ref string) ([]Commit, error)

func (*Checkout) CommitsBetween

func (c *Checkout) CommitsBetween(ctx context.Context, ref1, ref2 string) ([]Commit, error)

func (*Checkout) GetNote

func (c *Checkout) GetNote(ctx context.Context, rev string) (*Note, error)

GetNote gets a note for the revision specified, or nil if there is no such note.

func (*Checkout) HeadRevision

func (c *Checkout) HeadRevision(ctx context.Context) (string, error)

func (*Checkout) ManifestDir

func (c *Checkout) ManifestDir() string

ManifestDir returns a path to where the files are

func (*Checkout) MoveTagAndPush

func (c *Checkout) MoveTagAndPush(ctx context.Context, ref, msg string) error

func (*Checkout) NoteRevList

func (c *Checkout) NoteRevList(ctx context.Context) (map[string]struct{}, error)

func (*Checkout) Pull

func (c *Checkout) Pull(ctx context.Context) error

Pull fetches the latest commits on the branch we're using, and the latest notes

func (*Checkout) TagRevision

func (c *Checkout) TagRevision(ctx context.Context, tag string) (string, error)

func (*Checkout) WorkingClone

func (c *Checkout) WorkingClone(ctx context.Context) (*Checkout, error)

WorkingClone makes a(nother) clone of the repository to use for e.g., rewriting files, so we can keep a pristine clone for reading out of.

type Commit

type Commit struct {
	Revision string
	Message  string
}

type CommitAction

type CommitAction struct {
	Author  string
	Message string
}

CommitAction - struct holding commit information

type Config

type Config struct {
	SyncTag   string
	NotesRef  string
	UserName  string
	UserEmail string
	SetAuthor bool
}

Config holds some values we use when working in the local copy of the repo

type Note

type Note struct {
	JobID  job.ID        `json:"jobID"`
	Spec   update.Spec   `json:"spec"`
	Result update.Result `json:"result"`
}

type Repo

type Repo struct {
	flux.GitRemoteConfig
}

Repo represents a (remote) git repo.

func (Repo) Clone

func (r Repo) Clone(ctx context.Context, c Config) (*Checkout, error)

Get a local clone of the upstream repo, and use the config given.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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