actions

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already exists")
View Source
var ErrBranchNameExists = errors.New("workspace name must not be existing branch name")
View Source
var ErrCOBranchDelete = errors.New("attempted to delete checked out branch")
View Source
var ErrCOWorkspaceDelete = errors.New("attempted to delete checked out workspace")
View Source
var ErrCannotPushRef = errors.New("cannot push ref")
View Source
var ErrCantFF = errors.New("can't fast forward merge")
View Source
var ErrCloneFailed = errors.New("clone failed")
View Source
var ErrEmailNotFound = errors.New("could not determine email. run dolt config --global --add user.email")
View Source
var ErrFailedToAccessDir = errors.New("unable to access directories")
View Source
var ErrFailedToCreateDirectory = errors.New("unable to create directories")
View Source
var ErrFailedToCreateRemoteRef = errors.New("could not create remote ref")
View Source
var ErrFailedToCreateRepoStateWithRemote = errors.New("unable to create repo state with remote")
View Source
var ErrFailedToDeleteBackup = errors.New("failed to delete backup")
View Source
var ErrFailedToDeleteBranch = errors.New("could not delete local branch after clone")
View Source
var ErrFailedToDeleteRemote = errors.New("failed to delete remote")
View Source
var ErrFailedToGetBackupDb = errors.New("failed to get backup db")
View Source
var ErrFailedToGetBranch = errors.New("could not get branch")
View Source
var ErrFailedToGetRemoteDb = errors.New("failed to get remote db")
View Source
var ErrFailedToGetRootValue = errors.New("could not find root value")
View Source
var ErrFailedToInitRepo = errors.New("")
View Source
var ErrFailedToListBranches = errors.New("failed to list branches")
View Source
var ErrFailedToResolveBranchRef = errors.New("could not resole branch ref")
View Source
var ErrFailedToSaveRepoState = errors.New("failed to save repo state")
View Source
var ErrFailedToUpdateDocs = errors.New("failed to update docs on the filesystem")
View Source
var ErrInvalidPullArgs = errors.New("dolt pull takes at most one arg")
View Source
var ErrNoDataAtRemote = errors.New("remote at that url contains no Dolt data")
View Source
var ErrRepositoryExists = errors.New("data repository already exists")
View Source
var ErrUnknownPushErr = errors.New("unknown push error")
View Source
var ErrUnmergedBranchDelete = errors.New("attempted to delete a branch that is not fully merged into its parent; use `-f` to force")
View Source
var ErrUnmergedWorkspaceDelete = errors.New("attempted to delete a workspace that is not fully merged into its parent; use `-f` to force")
View Source
var ErrUserNotFound = errors.New("could not determine user name. run dolt config --global --add user.name")

Functions

func AddCommits

func AddCommits(ctx context.Context, ddb *doltdb.DoltDB, commit *doltdb.Commit, hashToCommit map[hash.Hash]*doltdb.Commit, n int) error

func BranchRoot

func BranchRoot(ctx context.Context, db *doltdb.DoltDB, brName string) (*doltdb.RootValue, error)

BranchRoot returns the root value at the branch with the name given TODO: this belongs in DoltDB, maybe

func CheckoutAllTables

func CheckoutAllTables(ctx context.Context, roots doltdb.Roots, dbData env.DbData) error

func CheckoutBranch

func CheckoutBranch(ctx context.Context, dEnv *env.DoltEnv, brName string, force bool) error

func CheckoutBranchNoDocs

func CheckoutBranchNoDocs(ctx context.Context, roots doltdb.Roots, branchRoot *doltdb.RootValue, rsw env.RepoStateWriter, branchRef ref.BranchRef, force bool) error

func CheckoutTablesAndDocs

func CheckoutTablesAndDocs(ctx context.Context, roots doltdb.Roots, dbData env.DbData, tables []string, docs doltdocs.Docs) error

CheckoutTablesAndDocs takes in a set of tables and docs and checks them out to another branch.

func CheckoutWouldOverwriteTables

func CheckoutWouldOverwriteTables(err error) []string

func CleanUntracked

func CleanUntracked(ctx context.Context, roots doltdb.Roots, tables []string, dryrun bool) (doltdb.Roots, error)

CleanUntracked deletes untracked tables from the working root. Evaluates untracked tables as: all working tables - all staged tables.

func Clone

func Clone(ctx context.Context, srcDB, destDB *doltdb.DoltDB, eventCh chan<- pull.TableFileEvent) error

Clone pulls all data from a remote source database to a local destination database.

func CloneRemote

func CloneRemote(ctx context.Context, srcDB *doltdb.DoltDB, remoteName, branch string, dEnv *env.DoltEnv) error

func CommitStaged

func CommitStaged(ctx context.Context, roots doltdb.Roots, mergeActive bool, mergeParents []*doltdb.Commit, dbData env.DbData, props CommitStagedProps) (*doltdb.Commit, error)

CommitStaged adds a new commit to HEAD with the given props. Returns the new commit's hash as a string and an error.

func CopyBranch

func CopyBranch(ctx context.Context, dEnv *env.DoltEnv, oldBranch, newBranch string, force bool) error

func CopyBranchOnDB

func CopyBranchOnDB(ctx context.Context, ddb *doltdb.DoltDB, oldBranch, newBranch string, force bool) error

func CreateBranchOnDB

func CreateBranchOnDB(ctx context.Context, ddb *doltdb.DoltDB, newBranch, startingPoint string, force bool, headRef ref.DoltRef) error

func CreateBranchWithStartPt

func CreateBranchWithStartPt(ctx context.Context, dbData env.DbData, newBranch, startPt string, force bool) error

func CreateTag

func CreateTag(ctx context.Context, dEnv *env.DoltEnv, tagName, startPoint string, props TagProps) error

func CreateTagOnDB

func CreateTagOnDB(ctx context.Context, ddb *doltdb.DoltDB, tagName, startPoint string, props TagProps, headRef ref.DoltRef) error

func CreateWorkspace

func CreateWorkspace(ctx context.Context, dEnv *env.DoltEnv, name, startPoint string) error

func CreateWorkspaceOnDB

func CreateWorkspaceOnDB(ctx context.Context, ddb *doltdb.DoltDB, name, startPoint string, headRef ref.DoltRef) error

func DeleteBranch

func DeleteBranch(ctx context.Context, dEnv *env.DoltEnv, brName string, opts DeleteOptions) error

func DeleteBranchOnDB

func DeleteBranchOnDB(ctx context.Context, dEnv *env.DoltEnv, dref ref.DoltRef, opts DeleteOptions) error

func DeleteRemoteBranch

func DeleteRemoteBranch(ctx context.Context, targetRef ref.BranchRef, remoteRef ref.RemoteRef, localDB, remoteDB *doltdb.DoltDB) error

DeleteRemoteBranch validates targetRef is a branch on the remote database, and then deletes it, then deletes the remote tracking branch from the local database.

func DeleteTags

func DeleteTags(ctx context.Context, dEnv *env.DoltEnv, tagNames ...string) error

func DeleteTagsOnDB

func DeleteTagsOnDB(ctx context.Context, ddb *doltdb.DoltDB, tagNames ...string) error

func DeleteWorkspace

func DeleteWorkspace(ctx context.Context, dEnv *env.DoltEnv, workspaceName string, opts DeleteOptions) error

func DeleteWorkspaceOnDB

func DeleteWorkspaceOnDB(ctx context.Context, dEnv *env.DoltEnv, dref ref.DoltRef, opts DeleteOptions) error

func DoPush

func DoPush(ctx context.Context, rsr env.RepoStateReader, rsw env.RepoStateWriter, srcDB *doltdb.DoltDB, tempTableDir string, opts *env.PushOpts, progStarter ProgStarter, progStopper ProgStopper) error

func EnsureCredsDir

func EnsureCredsDir(dEnv *env.DoltEnv) (string, errhand.VerboseError)

func EnvForClone

func EnvForClone(ctx context.Context, nbf *types.NomsBinFormat, r env.Remote, dir string, fs filesys.Filesys, version string, homeProvider env.HomeDirProvider) (*env.DoltEnv, error)

func FetchCommit

func FetchCommit(ctx context.Context, tempTablesDir string, srcDB, destDB *doltdb.DoltDB, srcDBCommit *doltdb.Commit, progChan chan pull.PullProgress, statsCh chan pull.Stats) error

FetchCommit takes a fetches a commit and all underlying data from a remote source database to the local destination database.

func FetchFollowTags

func FetchFollowTags(ctx context.Context, tempTableDir string, srcDB, destDB *doltdb.DoltDB, progStarter ProgStarter, progStopper ProgStopper) error

FetchFollowTags fetches all tags from the source DB whose commits have already been fetched into the destination DB. todo: potentially too expensive to iterate over all srcDB tags

func FetchRefSpecs

func FetchRefSpecs(ctx context.Context, dbData env.DbData, refSpecs []ref.RemoteRefSpec, remote env.Remote, mode ref.UpdateMode, progStarter ProgStarter, progStopper ProgStopper) error

FetchRefSpecs is the common SQL and CLI entrypoint for fetching branches, tags, and heads from a remote.

func FetchRemoteBranch

func FetchRemoteBranch(
	ctx context.Context,
	tempTablesDir string,
	rem env.Remote,
	srcDB, destDB *doltdb.DoltDB,
	srcRef ref.DoltRef,
	progStarter ProgStarter,
	progStopper ProgStopper,
) (*doltdb.Commit, error)

FetchRemoteBranch fetches and returns the |Commit| corresponding to the remote ref given. Returns an error if the remote reference doesn't exist or can't be fetched. Blocks until the fetch is complete.

func FetchTag

func FetchTag(ctx context.Context, tempTableDir string, srcDB, destDB *doltdb.DoltDB, srcDBTag *doltdb.Tag, progChan chan pull.PullProgress, statsCh chan pull.Stats) error

FetchTag takes a fetches a commit tag and all underlying data from a remote source database to the local destination database.

func GenCredsWithVErr

func GenCredsWithVErr() (creds.DoltCreds, errhand.VerboseError)

func GetCommitStaged

func GetCommitStaged(
	ctx context.Context,
	roots doltdb.Roots,
	mergeActive bool,
	mergeParents []*doltdb.Commit,
	dbData env.DbData,
	props CommitStagedProps,
) (*doltdb.PendingCommit, error)

GetCommitStaged adds a new commit to HEAD with the given props, returning it as a PendingCommit that can be committed with doltdb.CommitWithWorkingSet

func GetRemoteBranchRef

func GetRemoteBranchRef(ctx context.Context, ddb *doltdb.DoltDB, name string) (ref.DoltRef, bool, error)

GetRemoteBranchRef returns the ref of a branch and ensures it matched with name. It will also return boolean value representing whether there is not match or not and an error if there is one.

func GetTablesForError

func GetTablesForError(err error) []string

func GetTablesOrDocs

func GetTablesOrDocs(drw env.DocsReadWriter, tablesOrFiles []string) (tables []string, docs doltdocs.Docs, err error)

GetTablesOrDocs takes a slice of table or file names. Table names are returned as given. Supported doc names are read from disk and their name replace with the names of the dolt_docs system table in the input slice. Supported docs are returned in the second return param.

func GetUnstagedDocs

func GetUnstagedDocs(ctx context.Context, dEnv *env.DoltEnv) (doltdocs.Docs, error)

GetUnstagedDocs retrieves the unstaged docs (docs from the filesystem).

func GetUnstagedDocsFromRoots

func GetUnstagedDocsFromRoots(ctx context.Context, dEnv *env.DoltEnv, roots doltdb.Roots) (doltdocs.Docs, error)

func InferColumnTypesFromTableReader

func InferColumnTypesFromTableReader(ctx context.Context, root *doltdb.RootValue, rd table.TableReadCloser, args InferenceArgs) (*schema.ColCollection, error)

InferColumnTypesFromTableReader will infer a data types from a table reader.

func InitEmptyClonedRepo

func InitEmptyClonedRepo(ctx context.Context, dEnv *env.DoltEnv) error

Inits an empty, newly cloned repo. This would be unnecessary if we properly initialized the storage for a repository when we created it on dolthub. If we do that, this code can be removed.

func IsBranch

func IsBranch(ctx context.Context, ddb *doltdb.DoltDB, str string) (bool, error)

func IsBranchOnDB

func IsBranchOnDB(ctx context.Context, ddb *doltdb.DoltDB, str string) (bool, error)

func IsCheckoutWouldOverwrite

func IsCheckoutWouldOverwrite(err error) bool

func IsNothingStaged

func IsNothingStaged(err error) bool

func IsTblError

func IsTblError(err error) bool

func IsTblInConflict

func IsTblInConflict(err error) bool

func IsTblNotExist

func IsTblNotExist(err error) bool

func IsTblViolatesConstraints

func IsTblViolatesConstraints(err error) bool

func IsWorkspace

func IsWorkspace(ctx context.Context, dEnv *env.DoltEnv, str string) (bool, error)

func IsWorkspaceOnDB

func IsWorkspaceOnDB(ctx context.Context, ddb *doltdb.DoltDB, str string) (bool, error)

func IterResolvedTags

func IterResolvedTags(ctx context.Context, ddb *doltdb.DoltDB, cb func(tag *doltdb.Tag) (stop bool, err error)) error

IterResolvedTags iterates over tags in dEnv.DoltDB from newest to oldest, resolving the tag to a commit and calling cb().

func MaybeGetCommit

func MaybeGetCommit(ctx context.Context, dEnv *env.DoltEnv, str string) (*doltdb.Commit, error)

func MoveTablesBetweenRoots

func MoveTablesBetweenRoots(ctx context.Context, tbls []string, src, dest *doltdb.RootValue) (*doltdb.RootValue, error)

MoveTablesBetweenRoots copies tables with names in tbls from the src RootValue to the dest RootValue. It matches tables between roots by column tags.

func MoveTablesFromHeadToWorking

func MoveTablesFromHeadToWorking(ctx context.Context, roots doltdb.Roots, tbls []string) (doltdb.Roots, error)

MoveTablesFromHeadToWorking replaces the tables named from the given head to the given working root, overwriting any working changes, and returns the new resulting roots

func NewCredsFile

func NewCredsFile(dEnv *env.DoltEnv) (string, creds.DoltCreds, errhand.VerboseError)

func NoopRunProgFuncs

func NoopRunProgFuncs(ctx context.Context) (*sync.WaitGroup, chan pull.PullProgress, chan pull.Stats)

func NoopStopProgFuncs

func NoopStopProgFuncs(cancel context.CancelFunc, wg *sync.WaitGroup, progChan chan pull.PullProgress, statsCh chan pull.Stats)

func NothingStagedDocsDiffs

func NothingStagedDocsDiffs(err error) *diff.DocDiffs

func NothingStagedTblDiffs

func NothingStagedTblDiffs(err error) []diff.TableDelta

func Push

func Push(ctx context.Context, tempTableDir string, mode ref.UpdateMode, destRef ref.BranchRef, remoteRef ref.RemoteRef, srcDB, destDB *doltdb.DoltDB, commit *doltdb.Commit, progChan chan pull.PullProgress, statsCh chan pull.Stats) error

Push will update a destination branch, in a given destination database if it can be done as a fast forward merge. This is accomplished first by verifying that the remote tracking reference for the source database can be updated to the given commit via a fast forward merge. If this is the case, an attempt will be made to update the branch in the destination db to the given commit via fast forward move. If that succeeds the tracking branch is updated in the source db.

func PushTag

func PushTag(ctx context.Context, tempTableDir string, destRef ref.TagRef, srcDB, destDB *doltdb.DoltDB, tag *doltdb.Tag, progChan chan pull.PullProgress, statsCh chan pull.Stats) error

PushTag pushes a commit tag and all underlying data from a local source database to a remote destination database.

func PushToRemoteBranch

func PushToRemoteBranch(ctx context.Context, rsr env.RepoStateReader, tempTableDir string, mode ref.UpdateMode, srcRef, destRef, remoteRef ref.DoltRef, localDB, remoteDB *doltdb.DoltDB, remote env.Remote, progStarter ProgStarter, progStopper ProgStopper) error

func RemoveDocsTable

func RemoveDocsTable(tbls []string) []string

RemoveDocsTable takes a slice of table names and returns a new slice with DocTableName removed.

func RenameBranch

func RenameBranch(ctx context.Context, dEnv *env.DoltEnv, oldBranch, newBranch string, force bool) error

func ResetHard

func ResetHard(ctx context.Context, dEnv *env.DoltEnv, cSpecStr string, roots doltdb.Roots) error

func ResetHardTables

func ResetHardTables(ctx context.Context, dbData env.DbData, cSpecStr string, roots doltdb.Roots) (*doltdb.Commit, doltdb.Roots, error)

ResetHardTables resets the tables in working, staged, and head based on the given parameters. Returns the new head commit and resulting roots

func ResetSoft

func ResetSoft(ctx context.Context, dbData env.DbData, tables []string, roots doltdb.Roots) (doltdb.Roots, error)

ResetSoft resets the staged value from HEAD for the tables given and returns the updated roots.

func ResetSoftTables

func ResetSoftTables(ctx context.Context, dbData env.DbData, apr *argparser.ArgParseResults, roots doltdb.Roots) (doltdb.Roots, error)

func ResetSoftToRef

func ResetSoftToRef(ctx context.Context, dbData env.DbData, cSpecStr string) error

ResetSoftToRef matches the `git reset --soft <REF>` pattern. It resets both staged and head to the previous ref and leaves the working unset. The user can then choose to create a commit that contains all changes since the ref.

func SaveDocsFromRoot

func SaveDocsFromRoot(ctx context.Context, root *doltdb.RootValue, dEnv *env.DoltEnv) error

SaveDocsFromRoot saves docs from the root given to the filesystem, and could overwrite untracked docs.

func SaveDocsFromWorkingExcludingFSChanges

func SaveDocsFromWorkingExcludingFSChanges(ctx context.Context, dEnv *env.DoltEnv, docsToExclude doltdocs.Docs) error

SaveDocsFromWorkingExcludingFSChanges saves docs from the working root to the filesystem, and does not overwrite changes to docs on the FS. Intended to be called after checking that no conflicts exist (during a checkout or merge, i.e.).

func SaveTrackedDocs

func SaveTrackedDocs(ctx context.Context, drw env.DocsReadWriter, workRoot, targetRoot *doltdb.RootValue, localDocs doltdocs.Docs) error

SaveTrackedDocs writes the docs from the targetRoot to the filesystem. The working root is used to identify untracked docs, which are left unchanged.

func SaveTrackedDocsFromWorking

func SaveTrackedDocsFromWorking(ctx context.Context, dEnv *env.DoltEnv) error

SaveTrackedDocsFromWorking saves docs from the working root to the filesystem, and doesn't modify untracked docs.

func StageAllTables

func StageAllTables(ctx context.Context, roots doltdb.Roots, docs doltdocs.Docs) (doltdb.Roots, error)

func StageAllTablesNoDocs

func StageAllTablesNoDocs(ctx context.Context, roots doltdb.Roots) (doltdb.Roots, error)

func StageTables

func StageTables(ctx context.Context, roots doltdb.Roots, docs doltdocs.Docs, tbls []string) (doltdb.Roots, error)

func StageTablesNoDocs

func StageTablesNoDocs(ctx context.Context, roots doltdb.Roots, tbls []string) (doltdb.Roots, error)

func SyncRoots

func SyncRoots(ctx context.Context, srcDb, destDb *doltdb.DoltDB, tempTableDir string, progStarter ProgStarter, progStopper ProgStopper) error

SyncRoots copies the entire chunkstore from srcDb to destDb and rewrites the remote manifest. Used to streamline database backup and restores. TODO: this should read/write a backup lock file specific to the client who created the backup TODO to prevent "restoring a remote", "cloning a backup", "syncing a remote" and "pushing TODO a backup." SyncRoots has more destructive potential than push right now.

func TimeSortedCommits

func TimeSortedCommits(ctx context.Context, ddb *doltdb.DoltDB, commit *doltdb.Commit, n int) ([]*doltdb.Commit, error)

TimeSortedCommits returns a reverse-chronological (latest-first) list of the most recent `n` ancestors of `commit`. Passing a negative value for `n` will result in all ancestors being returned.

func UpdateRootsForBranch

func UpdateRootsForBranch(ctx context.Context, roots doltdb.Roots, branchRoot *doltdb.RootValue, force bool) (doltdb.Roots, error)

UpdateRootsForBranch writes the roots needed for a branch checkout and returns the updated roots. |roots.Head| should be the pre-checkout head. The returned roots struct has |Head| set to |branchRoot|.

func ValidateIsRef

func ValidateIsRef(ctx context.Context, cSpecStr string, ddb *doltdb.DoltDB, rsr env.RepoStateReader) bool

ValidateIsRef validates whether the input parameter is a valid cString

func ValidateTables

func ValidateTables(ctx context.Context, tbls []string, roots ...*doltdb.RootValue) error

ValidateTables checks that all tables passed exist in at least one of the roots passed.

Types

type CheckoutWouldOverwrite

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

func (CheckoutWouldOverwrite) Error

func (cwo CheckoutWouldOverwrite) Error() string

type CommitStagedProps

type CommitStagedProps struct {
	Message    string
	Date       time.Time
	AllowEmpty bool
	Force      bool
	Name       string
	Email      string
}

type DeleteOptions

type DeleteOptions struct {
	Force  bool
	Remote bool
}

type InferenceArgs

type InferenceArgs interface {
	// ColNameMapper allows columns named X in the schema to be named Y in the inferred schema.
	ColNameMapper() rowconv.NameMapper
	// FloatThreshold is the threshold at which a string representing a floating point number should be interpreted as
	// a float versus an int.  If FloatThreshold is 0.0 then any number with a decimal point will be interpreted as a
	// float (such as 0.0, 1.0, etc).  If FloatThreshold is 1.0 then any number with a decimal point will be converted
	// to an int (0.5 will be the int 0, 1.99 will be the int 1, etc.  If the FloatThreshold is 0.001 then numbers with
	// a fractional component greater than or equal to 0.001 will be treated as a float (1.0 would be an int, 1.0009 would
	// be an int, 1.001 would be a float, 1.1 would be a float, etc)
	FloatThreshold() float64
}

InferenceArgs are arguments that can be passed to the schema inferrer to modify it's inference behavior.

type NothingStaged

type NothingStaged struct {
	NotStagedTbls []diff.TableDelta
	NotStagedDocs *diff.DocDiffs
}

func (NothingStaged) Error

func (ns NothingStaged) Error() string

type ProgStarter

type ProgStarter func(ctx context.Context) (*sync.WaitGroup, chan pull.PullProgress, chan pull.Stats)

type ProgStopper

type ProgStopper func(cancel context.CancelFunc, wg *sync.WaitGroup, progChan chan pull.PullProgress, statsCh chan pull.Stats)

type TagProps

type TagProps struct {
	TaggerName  string
	TaggerEmail string
	Description string
}

type TblError

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

func NewTblHasConstraintViolations

func NewTblHasConstraintViolations(tbls []string) TblError

func NewTblInConflictError

func NewTblInConflictError(tbls []string) TblError

func NewTblNotExistError

func NewTblNotExistError(tbls []string) TblError

func (TblError) Error

func (te TblError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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