Documentation
¶
Index ¶
- type Clone
- func (c *Clone) Add(path string) error
- func (c *Clone) AddAll() error
- func (c *Clone) AddFiles(clone *Clone, files []*PullRequestFileEntry) error
- func (c *Clone) AddRemote(name, url string) error
- func (c *Clone) Cleanup()
- func (c *Clone) Commit(opts *options.CommitOptions) error
- func (c *Clone) CreateFeatureBranch() error
- func (c *Clone) PushRemote(remoteName string) error
- type OptFn
- type PullRequestFileEntry
- type PullRequestManager
- func (prm *PullRequestManager) CheckFork(repo *models.Repository, forkName string) (*models.Repository, error)
- func (prm *PullRequestManager) CloneRepo(repo *models.Repository) (*Clone, error)
- func (prm *PullRequestManager) CreatePullRequest(repo *models.Repository, opts *options.PullRequestOptions) (*models.PullRequest, error)
- func (prm *PullRequestManager) PullRequestFileList(repo *models.Repository, opts *options.PullRequestFileListOptions, ...) (*models.PullRequest, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clone ¶
type Clone struct {
models.Repository
TmpDir string
FeatureBranch string
DefaultBranch string
// contains filtered or unexported fields
}
Clone is a local clone of a repository
func (*Clone) AddFiles ¶
func (c *Clone) AddFiles(clone *Clone, files []*PullRequestFileEntry) error
AddFiles copies a list of files into the clone filesystem. All
func (*Clone) Cleanup ¶
func (c *Clone) Cleanup()
CleanUp is intended to remove any temporary files lying around
func (*Clone) Commit ¶
func (c *Clone) Commit(opts *options.CommitOptions) error
Commit creates a commit in the cloned repository. It expects files to be ready in the staging area.
func (*Clone) CreateFeatureBranch ¶
CreateFeatureBranch creates a branch in the local clone and switches to it.
func (*Clone) PushRemote ¶
PushToRemote pushes the active branch to the specified remote
type OptFn ¶
type OptFn func(*PullRequestManager)
func WithAuthenticator ¶
func WithAuthenticator(a *auth.Authenticator) OptFn
type PullRequestFileEntry ¶
type PullRequestFileEntry struct {
// Path is the path where the data will be wirtten, relative to the clone fs root
Path string
// io Reader to read the file data
Reader io.Reader
}
PullRequestFileEntry packs an io Reader and a path to write into a cloned repo
type PullRequestManager ¶
type PullRequestManager struct {
Options options.PullRequestManagerOptions
// contains filtered or unexported fields
}
PullRequestManager is a tool to create and manage pull requests on a GitHub repository.
func NewPullRequestManager ¶
func NewPullRequestManager(fn ...OptFn) *PullRequestManager
func (*PullRequestManager) CheckFork ¶
func (prm *PullRequestManager) CheckFork(repo *models.Repository, forkName string) (*models.Repository, error)
CheckFork verifies that the logged in user has a fork of the specified repo. If a name is specified, then the function will look for a repo with a different name than the forked source.
func (*PullRequestManager) CloneRepo ¶
func (prm *PullRequestManager) CloneRepo(repo *models.Repository) (*Clone, error)
CloneRepo clones the remote repository either to disk or to a memory filesystem
func (*PullRequestManager) CreatePullRequest ¶
func (prm *PullRequestManager) CreatePullRequest(repo *models.Repository, opts *options.PullRequestOptions) (*models.PullRequest, error)
CreatePullRequest opens a pull request in a repository
func (*PullRequestManager) PullRequestFileList ¶
func (prm *PullRequestManager) PullRequestFileList( repo *models.Repository, opts *options.PullRequestFileListOptions, files []*PullRequestFileEntry, ) (*models.PullRequest, error)
PullRequestFiles gets a list of files and opens a pull request in a repo to check them in. If the files already exist in the repo they will be updated with the new versions.