Documentation ¶
Index ¶
- Constants
- func AddFiles(files []string) (adds, updates int, err error)
- func Apply() (err error)
- func ApplyCommit(name, description string) (err error)
- func BranchFromCommit(branchName, commitHashOrName string, isHash bool) (err error)
- func Checkout(nameOrHash string, isCommit bool, isHash bool) (err error)
- func Download(selector *regexp.Regexp) (err error)
- func EnsureBRANCH() error
- func EnsureByPanic(ensurerFunc func() error, customMsg string)
- func EnsureChanges() error
- func EnsureConfig() error
- func EnsureHEAD() error
- func EnsureIDVRepo() error
- func EnsureLOCAL() error
- func EnsureLOCALIsBranchHead() error
- func EnsureLatestCommit() error
- func EnsureNoBranchOffs() error
- func EnsureNoChanges() error
- func EnsureNoStaged() error
- func EnsureSetup() (err error)
- func EnsureTREE() error
- func Initialize(name, description string, backend storage.Backend) (err error)
- func Inspect() (report string, err error)
- func Ls(selector *regexp.Regexp, fullPath bool) (report string, err error)
- func LsBranches() (report string, err error)
- func LsCommits() (report string, err error)
- func Pull() (err error)
- func RemoveFiles(files []string, names []string, unstage bool) (removals, unstages int, err error)
- func RemoveWithSelector(selector *regexp.Regexp, unstage bool) (removals, unstages int, err error)
- func Setup() (err error)
- func Status(fullPath, localPath bool) (report string, err error)
- func Unstage(selector *regexp.Regexp) (unstaged int, err error)
- type Branch
- type Commit
- func (c Commit) FormatDiff(head string, tail string, ifEmpty string, delim string, fullPath bool, ...) string
- func (c Commit) FormatFiles(selector *regexp.Regexp, head string, tail string, ifEmpty string, ...) string
- func (c *Commit) ParseFromFile(filepath string) error
- func (c Commit) ToFilePath(local bool) string
- func (c Commit) WriteToFolder(folderPath string) error
- type Stagemap
- type VTree
Constants ¶
const ( // LOCAL points to CurrentCommitFile, the local commit containing staged updates not yet pushed // Or in case of checking out to a commit which is not the head of a branch, it points to HEAD LOCAL string = IDVFolder + "LOCAL" // HEAD points to the commit that local repo thinks is the head of the current branch remotely, // essentially the parent of LOCAL HEAD string = IDVFolder + "HEAD" // BRANCH points to the branch that local operates on BRANCH string = IDVFolder + "BRANCH" // TREE points to the .vtree that local thinks is the most recent version of .vtree TREE string = IDVFolder + "TREE" )
const ( // IDVFolder is the name of the folder these files are stored in (like .git) IDVFolder string = ".idv/" )
useful folders folders for idv
Variables ¶
This section is empty.
Functions ¶
func AddFiles ¶
AddFiles stages new files to be added and existing files as Updates, expects a list of absolute file paths
func Apply ¶
func Apply() (err error)
Apply sets up the necessary stuff at the Daemon using idv-config.yaml
func ApplyCommit ¶
ApplyCommit finalizes the currently staged changes and submits it to the daemon
func BranchFromCommit ¶
BranchFromCommit branches off of the current commit onto a new branch
func EnsureByPanic ¶
EnsureByPanic takes one of the other Ensure functions and panics in case of an error rather than returning it
func EnsureChanges ¶
func EnsureChanges() error
EnsureChanges errors if the current LOCAL commit has no staged changes
func EnsureConfig ¶
func EnsureConfig() error
EnsureConfig checks whether there is a file called idv-config.yaml that can be parsed as config
func EnsureIDVRepo ¶
func EnsureIDVRepo() error
EnsureIDVRepo makes sure that we are in an idv repository
func EnsureLOCALIsBranchHead ¶
func EnsureLOCALIsBranchHead() error
EnsureLOCALIsBranchHead checks whether LOCAL is ahead of the current branch's branch.HEAD
func EnsureLatestCommit ¶
func EnsureLatestCommit() error
EnsureLatestCommit makes sure that the current LOCAL is ahead of the BRANCH.HEAD
func EnsureNoBranchOffs ¶
func EnsureNoBranchOffs() error
EnsureNoBranchOffs makes sure that there are no uncommitted branch and vtree files in .idv/local
func EnsureNoChanges ¶
func EnsureNoChanges() error
EnsureNoChanges errors if there are uncommitted changes staged
func EnsureNoStaged ¶
func EnsureNoStaged() error
EnsureNoStaged makes sure that there are no uncommitted staged changes in LOCAL
func EnsureSetup ¶
func EnsureSetup() (err error)
EnsureSetup checks whether the repo is (correctly) setup by checking all the supposed symlinks
func Initialize ¶
Initialize instantiates a new data repo and makes appropriate .idv folder structure
func Inspect ¶
Inspect returns the config file found in the same folder used for adding/committing and pusing data etc
func LsBranches ¶
LsBranches returns a string report specifying the list of currently known branches
func LsCommits ¶
LsCommits returns a string report specifying the list of commits on the current branch
func Pull ¶
func Pull() (err error)
Pull gets the latest vtree from the daemon and attempts to resolve any conflicts arising locally from this
func RemoveFiles ¶
RemoveFiles stages files for removal from the dataset files is expected to be a list of paths on this machine names can be random strings that are matched against names in the commit
func RemoveWithSelector ¶
RemoveWithSelector removes files from data set and staging based on a regex. All files matching the selector are staged for removal, or unstaged in case a staged files
func Setup ¶
func Setup() (err error)
Setup sets up the necessary stuff at the Daemon and locally links all necessary symlinks
Types ¶
type Branch ¶
type Branch struct { Name string `json:"name"` HEAD hash `json:"head"` Hash hash `json:"hash"` }
Branch internally defines a data version commit file
func (*Branch) ParseFromFile ¶
ParseFromFile tries to parse a .branch file
func (Branch) ToFilePath ¶
ToFilePath returns a path to this commit being: .idv/{local, remote}/branchhash.extension local indicates which of the 2 folders to use
func (Branch) WriteToFolder ¶
WriteToFolder writes the branch to the specified folder. Name of file is and should be determined by the branch structure
type Commit ¶
type Commit struct { Parent hash `json:"parent"` Branch hash `json:"branch"` Hash hash `json:"hash"` Name string `json:"name"` Description string `json:"description"` Files []string `json:"files"` Diff diff `json:"diff"` Deprecated deprecated `json:"deprecated"` }
Commit internally defines a data version commit file
func NewRootCommit ¶
func NewRootCommit(branch hash) Commit
NewRootCommit creates a bare, empty root commit for initializing a new repo
func (Commit) FormatDiff ¶
func (c Commit) FormatDiff(head string, tail string, ifEmpty string, delim string, fullPath bool, stagemap Stagemap) string
FormatDiff returns the list of changed files in the Diff as 1 long string interleaved with \n Usefull for display and filtering, head is prepended, tail is appended, isEmpty is used if no files are listed as follows: `headisEmptytail\n` else the strings produced are `OP file\n`, where OP is one of { U(pdated), R(emoved), A(dded)}
func (Commit) FormatFiles ¶
func (c Commit) FormatFiles(selector *regexp.Regexp, head string, tail string, ifEmpty string, delim string, fullPath bool) string
FormatFiles returns the list of files as 1 long string interleaved with \n Usefull for display and filtering, head is prepended, tail is appended, isEmpty is used if no files are listed as follows: `headisEmptytail`
func (*Commit) ParseFromFile ¶
ParseFromFile tries to parse a .commit file
func (Commit) ToFilePath ¶
ToFilePath returns a path to this commit being: .idv/{local, remote}/commithash.extension local indicates which of the 2 folders to use
func (Commit) WriteToFolder ¶
WriteToFolder writes the commit to the specified folder. Name of file is and should be determined by the commit structure
type Stagemap ¶
Stagemap is a structure mapping idv filepaths to absolute filepaths on this machine
func (*Stagemap) ParseFromFile ¶
ParseFromFile tries to parse a idv config file
func (Stagemap) WriteToFile ¶
WriteToFile writes the config to the specified file.
type VTree ¶
type VTree struct { Tree commitTree `json:"tree"` Branches branchMap `json:"branches"` }
VTree holds a version tree for data versioning
func (*VTree) ParseFromFile ¶
ParseFromFile tries to parse a history.vtree file
func (VTree) ToFilePath ¶
ToFilePath returns a path to this VTree being: .idv/{local, remote}/vtreeFileName local indicates which of the 2 folders to use
func (VTree) WriteToFolder ¶
WriteToFolder writes the tree to the specified folder. Name of file is and should be determined by the tree structure