Documentation ¶
Index ¶
- Variables
- func Apply(repoDir string, patch config.PackageRepoPatch, tmplCtx config.TemplateContext) error
- func ApplyMany(repoDir string, patches []config.PackageRepoPatch, ...) error
- type Patcher
- func (p Patcher) CloneAndPublishAll(pkgRepos []config.PackageRepo, tmplCtx config.TemplateContext) ([]github.PullRequest, error)
- func (p Patcher) CloneAndPublishRepo(pkgRepo config.PackageRepo, tmplCtx config.TemplateContext) (github.PullRequest, error)
- func (p Patcher) CloneRepo(remote string, tmplCtx config.TemplateContext) (*Repo, error)
- func (p Patcher) CloneWithConfig(cfg *config.Config) Patcher
- func (p Patcher) TestGitHubConnection(ctx context.Context) error
- type Repo
- func (p *Repo) ApplyManyAndCommit(patches []config.PackageRepoPatch) (git.Commit, error)
- func (p *Repo) ApplyManyInNewBranch(patches []config.PackageRepoPatch) error
- func (p *Repo) Close() error
- func (p *Repo) PublishChanges(commit git.Commit) (github.PullRequest, error)
- func (p *Repo) PublishChangesUnlessDryRun(commit git.Commit) (github.PullRequest, error)
- func (p *Repo) TemplateNewPullRequest(commit git.Commit) (github.NewPullRequest, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoPatches = errors.New("no patches configured for repository")
)
Functions ¶
func Apply ¶
func Apply(repoDir string, patch config.PackageRepoPatch, tmplCtx config.TemplateContext) error
Apply applies a single patch to the repository.
func ApplyMany ¶
func ApplyMany(repoDir string, patches []config.PackageRepoPatch, tmplCtx config.TemplateContext) error
ApplyMany applies a series of patches in sequence using Apply.
Types ¶
type Patcher ¶
type Patcher struct {
// contains filtered or unexported fields
}
Patcher is the manager for managing repositories and patching them, as well as pushing the changes in form of GitHub pull requests.
This is the main integration code between the other packages.
func (Patcher) CloneAndPublishAll ¶
func (p Patcher) CloneAndPublishAll(pkgRepos []config.PackageRepo, tmplCtx config.TemplateContext) ([]github.PullRequest, error)
CloneAndPublishAll will clone a list of Git repository, apply all the configured patches, and then publish the changes in the form of GitHub pull requests.
func (Patcher) CloneAndPublishRepo ¶
func (p Patcher) CloneAndPublishRepo(pkgRepo config.PackageRepo, tmplCtx config.TemplateContext) (github.PullRequest, error)
CloneAndPublishRepo will clone a Git repository, apply all the configured patches, and then publish the changes in the form of a GitHub pull requests.
func (Patcher) CloneRepo ¶
CloneRepo will download a Git repository from GitHub using the configured credentials. It is cloned using HTTPS instead of SSH.
func (Patcher) CloneWithConfig ¶ added in v0.5.0
CloneWithConfig creates a copy of this object, but with a new config.Config applied. Useful if you want to change just a few fields, such as the dry-run setting, while still reusing the GitHub App cache.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is an object to manage patches for a single repository. It is obtained from the Patcher object.
func (*Repo) ApplyManyAndCommit ¶
ApplyManyAndCommit uses [ApplyManyInNewBranch] to apply a series of patches in a new Git branch, followed by creating a Git commit.
func (*Repo) ApplyManyInNewBranch ¶
func (p *Repo) ApplyManyInNewBranch(patches []config.PackageRepoPatch) error
ApplyManyInNewBranch creates a new Git branch and then applies multiple patches in series using ApplyMany.
func (*Repo) PublishChanges ¶
PublishChanges will push the current Git branch to the remote, and then create a GitHub pull request.
func (*Repo) PublishChangesUnlessDryRun ¶
PublishChangesUnlessDryRun calls [PublishChanges], unless dry-run is set in the configs.
If dry-run is enabled, then this function templates all PR fields (title, description, etc), and then returns it as-is without pushing anything to the Git remote.
func (*Repo) TemplateNewPullRequest ¶ added in v0.5.0
TemplateNewPullRequest will template using text/template the pull request fields (title, description, etc), based on what's set in the config.