Documentation ¶
Index ¶
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- type GitVCS
- func (g *GitVCS) CloneTo(ctx context.Context, target string) error
- func (g *GitVCS) Commit(ctx context.Context, message string) error
- func (g *GitVCS) GetFile(ctx context.Context, rev string, pathFromRoot string) (*[]byte, error)
- func (g *GitVCS) Init(ctx context.Context) error
- func (g *GitVCS) InitRepo(ctx context.Context) error
- func (g GitVCS) NewRepo(dirpath string) VCS
- func (g *GitVCS) ReplaceFiles(ctx context.Context, folder, owner string) error
- func (g *GitVCS) RevisionCount(ctx context.Context, rev string) (int, error)
- func (g *GitVCS) Tag(ctx context.Context, tag string) error
- func (g *GitVCS) Walk(ctx context.Context, rev string, includeFolders bool, fn WalkFn) error
- func (g *GitVCS) Zip(ctx context.Context, rev, output string) (*string, error)
- type GoGitVCS
- func (g *GoGitVCS) CloneTo(ctx context.Context, target string) error
- func (g *GoGitVCS) GetFile(ctx context.Context, rev string, pathFromRoot string) (*[]byte, error)
- func (g *GoGitVCS) HasTag(tag string) (bool, error)
- func (g *GoGitVCS) InitRepo(ctx context.Context) error
- func (g GoGitVCS) NewRepo(dirpath string) VCS
- func (g *GoGitVCS) ReplaceFiles(ctx context.Context, folder, owner string) error
- func (g *GoGitVCS) RevisionCount(ctx context.Context, rev string) (int, error)
- func (g *GoGitVCS) Tag(ctx context.Context, tag string) error
- func (g *GoGitVCS) Walk(ctx context.Context, rev string, includeFolders bool, fn WalkFn) error
- func (g *GoGitVCS) Zip(ctx context.Context, rev, output string) (*string, error)
- type VCS
- type WalkFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
Types ¶
type GitVCS ¶
type GitVCS struct {
Path string
}
GitVCS represents a local Git repo.
func (*GitVCS) InitRepo ¶
InitRepo - Inits the version control repository and commits all files found. Git Path must exist.
func (*GitVCS) ReplaceFiles ¶
ReplaceFiles - replaces all files from repo HEAD with the files from the given folder. owner is an optional argument used to set the git commit user. If empty, then the default git user will be used.
func (*GitVCS) RevisionCount ¶
RevisionCount - get the number of revisions up to a specific revision If revision is empty, last commit from "master" branch will be used. Returns the number of revisions.
func (*GitVCS) Walk ¶
Walk - given a revision, Walk func iterates over the repository and invokes the WalkFn on each leaf file. If includeFolders argument is true then WalkFn will be invoked with folder nodes too. The function returns error if any WalkFn invocation ended with error. Revision argument can be an empty string; in that case "master" will be used.
type GoGitVCS ¶
type GoGitVCS struct { Path string // contains filtered or unexported fields }
GoGitVCS represents a local Git repo.
func (*GoGitVCS) HasTag ¶
HasTag - Checks for the existence of the given tag. Return bool, and an error if something unexpected happened.
func (*GoGitVCS) InitRepo ¶
InitRepo - Inits the version control repository and commits all files found. Git Path must exist.
func (*GoGitVCS) ReplaceFiles ¶
ReplaceFiles - replaces all files from repo HEAD with the files from the given folder. owner is an optional argument used to set the git commit user. If empty, then the default git user will be used.
func (*GoGitVCS) RevisionCount ¶
RevisionCount - get the number of revisions up to a specific revision If revision is empty, last commit from "master" branch will be used. Returns the number of revisions.
func (*GoGitVCS) Walk ¶
Walk - given a revision, Walk func iterates over the repository and invokes the WalkFn on each leaf file. If includeFolders argument is true then WalkFn will be invoked with folder nodes too. The function returns error if any WalkFn invocation ended with error. Revision argument can be an empty string; in that case the master branch will be used.
type VCS ¶
type VCS interface { CloneTo(ctx context.Context, target string) error GetFile(ctx context.Context, rev string, pathFromRoot string) (*[]byte, error) InitRepo(ctx context.Context) error ReplaceFiles(ctx context.Context, folder, owner string) error RevisionCount(ctx context.Context, rev string) (int, error) Tag(ctx context.Context, tag string) error Walk(ctx context.Context, rev string, includeFolders bool, fn WalkFn) error Zip(ctx context.Context, rev, output string) (*string, error) }
VCS - Version Control System basic interface.