Documentation ¶
Index ¶
- func Info(format string, args ...interface{})
- type Option
- type Repository
- func (c *Repository) Checkout(branchName string) error
- func (c *Repository) Commit(message string, files string) error
- func (c *Repository) Dir() string
- func (c *Repository) Fetch() error
- func (r *Repository) ListBranches(fetch bool) (branches []string, fetchErr error, err error)
- func (c *Repository) Pull() error
- func (c *Repository) Push() error
- func (c *Repository) Repo() *git.Repository
- func (c *Repository) Root() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(c *Repository) error
func Author ¶
Author is an Option to set the repository author. * * username: The username to use. * email: The email to use.
func EmbeddedToken ¶
EmbeddedToken is an Option to set the repository token. * the token will also be embedded in the remote url. * * token: The token to use.
func Preserve ¶
func Preserve() Option
Preserve is an Option to set the repository to be preserved. * For use with Temporary to keep the tmp/repo-* directory alive * * Returns error if something goes wrong.
func Temporary ¶
func Temporary() Option
Temporary is an Option to set the repository to be temporary. * * Returns error if something goes wrong.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents a repository. * * ctx: The context to use. * repo: The repository. * workdir: The working directory. * i_cloned_it: If I cloned the repository. * url: The url to the repository. * auth: The authentication to use. * root: The root of the repository. * ephemeral: If the repository is ephemeral. * ephemeralNoDelete: If the ephemeral repository should not be deleted. * user: The user to use. * branches: The branches to use. * usingSpecifcBranch: If a specific branch is used.
func New ¶
func New(ctx context.Context, options ...Option) (c *Repository, err error)
New creates a new repository.
- ctx: The context to use.
- options: The options to use. *
- Returns the repository and error if something goes wrong.
func (*Repository) Checkout ¶
func (c *Repository) Checkout(branchName string) error
func (*Repository) Commit ¶
func (c *Repository) Commit(message string, files string) error
Commit commits the changes to the repository. * * message: The message to be used for the commit. * files: The files to be committed. * * Returns error if something goes wrong.
func (*Repository) Dir ¶
func (c *Repository) Dir() string
Dir returns the directory of the repository.
func (*Repository) Fetch ¶
func (c *Repository) Fetch() error
Fetch fetches the changes from the repository. * * Returns error if something goes wrong.
func (*Repository) ListBranches ¶
func (r *Repository) ListBranches(fetch bool) (branches []string, fetchErr error, err error)
ListBranches will return a list of branches for the repository
fetch true will search remote origin to gather all branches fetch false will search .git/config to gather branches
func (*Repository) Pull ¶
func (c *Repository) Pull() error
Pull pulls the changes from the repository. * * Returns error if something goes wrong.
func (*Repository) Push ¶
func (c *Repository) Push() error
Push pushes the changes to the repository. * * Returns error if something goes wrong.
func (*Repository) Repo ¶
func (c *Repository) Repo() *git.Repository
func (*Repository) Root ¶
func (c *Repository) Root() string
Root returns the root directory of the repository.