Documentation ¶
Index ¶
- Constants
- Variables
- func DarkRed(s string) string
- func DarkYellow(s string) string
- func DisplayCommentAdded(cmt gh.Comment)
- func DisplayComments(comments []gh.Comment)
- func DisplayContributors(c *cli.Context, contributors []*gh.Contributor)
- func DisplayIssue(issue *gh.Issue, comments []gh.Comment)
- func DisplayIssues(c *cli.Context, v interface{}, notrunc bool)
- func DisplayPatch(r io.Reader) error
- func DisplayPullRequest(pr *gh.PullRequest, status gh.CombinedStatus)
- func DisplayPullRequests(c *cli.Context, pulls []*gh.PullRequest, notrunc bool)
- func DisplayReviewers(c *cli.Context, reviewers map[string][]string)
- func Fatalf(format string, args ...interface{})
- func GenBranchName(text string) string
- func GetDefaultGitRemote() string
- func GetDirsForPR(src []byte, dir string) ([]string, error)
- func GetFileExtensionsForPR(src []byte, ext string) ([]string, error)
- func GetGitConfig(name string) ([]byte, error)
- func GetGordonOrigin() (string, error)
- func GetMaintainerManagerEmail() (string, error)
- func GetMaintainersFromRepo(repoPath string, withUsername bool) (map[string][]string, error)
- func GetRemoteUrl(remote string) (string, string, error)
- func GetReviewersForPR(patch []byte, withUsername bool) (map[string][]string, error)
- func GetTopLevelGitRepo() (string, error)
- func Git(args ...string) error
- func Green(s string) string
- func HumanDuration(d time.Duration) string
- func PrintVerboseCommand(cmd *exec.Cmd)
- func Red(s string) string
- func ReviewPatch(input []byte, maintainers map[string][]string) (map[string][]string, error)
- func SaveConfig(config Config) error
- func Yellow(s string) string
- type ByAdditions
- type ByCommits
- type ByDeletions
- type Config
- type ContributorStats
- type Maintainer
- type MaintainerFile
- type MaintainerManager
- func (m *MaintainerManager) AddComment(number, comment string) (gh.Comment, error)
- func (m *MaintainerManager) Checkout(pr *gh.PullRequest) error
- func (m *MaintainerManager) Close(number string) error
- func (m *MaintainerManager) CreatePullRequest(base, head, title, body string) (*gh.PullRequest, error)
- func (m *MaintainerManager) GetComments(number string) ([]gh.Comment, error)
- func (m *MaintainerManager) GetContributors() ([]*gh.Contributor, error)
- func (m *MaintainerManager) GetFirstIssue(state, sortBy string) (*gh.Issue, error)
- func (m *MaintainerManager) GetFirstPullRequest(state, sortBy string) (*gh.PullRequest, error)
- func (m *MaintainerManager) GetFullPullRequests(prs []*gh.PullRequest, needFullPr, needComments bool) []*gh.PullRequest
- func (m *MaintainerManager) GetGithubUser() (*gh.User, error)
- func (m *MaintainerManager) GetIssue(number string, comments bool) (*gh.Issue, []gh.Comment, error)
- func (m *MaintainerManager) GetIssues(state, assignee string) ([]*gh.Issue, error)
- func (m *MaintainerManager) GetIssuesFound(query string) ([]*gh.SearchItem, error)
- func (m *MaintainerManager) GetPullRequest(number string) (*gh.PullRequest, error)
- func (m *MaintainerManager) GetPullRequestFiles(number string) ([]*gh.PullRequestFile, error)
- func (m *MaintainerManager) GetPullRequests(state, sort string) ([]*gh.PullRequest, error)
- func (m *MaintainerManager) GetStatus(pr *gh.PullRequest) (gh.CombinedStatus, error)
- func (m *MaintainerManager) MergePullRequest(number, comment string, force bool) (gh.Merge, error)
- func (m *MaintainerManager) PatchIssue(number string, issue *gh.Issue) (*gh.Issue, error)
- func (m *MaintainerManager) PatchPullRequest(number string, pr *gh.PullRequest) (*gh.PullRequest, error)
- func (m *MaintainerManager) Repository() (*gh.Repository, error)
Constants ¶
const ( MaintainerFileName = "MAINTAINERS" NumWorkers = 10 )
const Version = "1"
Variables ¶
var ( VerboseOutput = false ErrNoUsernameKnown = errors.New("No Username known - you probably need to use the `auth` option to configure your GitHub token") )
var Colorize bool
Functions ¶
func DarkYellow ¶
func DisplayCommentAdded ¶
func DisplayComments ¶
func DisplayContributors ¶
func DisplayContributors(c *cli.Context, contributors []*gh.Contributor)
func DisplayIssues ¶
Display Issues prints `issues` to standard output in a human-friendly tabulated format.
func DisplayPatch ¶
func DisplayPullRequest ¶
func DisplayPullRequest(pr *gh.PullRequest, status gh.CombinedStatus)
func DisplayPullRequests ¶
func DisplayPullRequests(c *cli.Context, pulls []*gh.PullRequest, notrunc bool)
func GenBranchName ¶
GenBranchName returns a generated branch name from a human-readable description.
For example this:
`GenBranchName(" Hey! let's do awesome stuff...")`
Will return this:
`"hey_let_s_do_awesome_stuff"`
func GetDefaultGitRemote ¶
func GetDefaultGitRemote() string
func GetGitConfig ¶
func GetGordonOrigin ¶
func GetMaintainersFromRepo ¶
GetMaintainersFromRepo returns the maintainers for a repo with the username as the key and the file's that they own as a slice in the value
func GetReviewersForPR ¶
func GetTopLevelGitRepo ¶
func HumanDuration ¶
HumanDuration returns a human-readable approximation of a duration This function is taken from the Docker project, and slightly modified to cap units at days. (eg. "About a minute", "4 hours ago", etc.) (c) 2013 Docker, inc. and the Docker authors (http://docker.io)
func PrintVerboseCommand ¶
func ReviewPatch ¶
ReviewPatch reads a git-formatted patch from `src`, and for each file affected by the patch it assign its Maintainers based on the current repository tree directories The list of Maintainers are generated when the MaintainerManager object is instantiated.
The result is a map where the keys are the paths of files affected by the patch, and the values are the maintainers assigned to review that partiular file.
There is no duplicate checks: the same maintainer may be present in multiple entries of the map, or even multiple times in the same entry if the MAINTAINERS file has duplicate lines.
func SaveConfig ¶
Types ¶
type ByAdditions ¶
type ByAdditions []ContributorStats
func (ByAdditions) Len ¶
func (a ByAdditions) Len() int
func (ByAdditions) Less ¶
func (a ByAdditions) Less(i, j int) bool
func (ByAdditions) Swap ¶
func (a ByAdditions) Swap(i, j int)
type ByCommits ¶
type ByCommits []ContributorStats
type ByDeletions ¶
type ByDeletions []ContributorStats
func (ByDeletions) Len ¶
func (a ByDeletions) Len() int
func (ByDeletions) Less ¶
func (a ByDeletions) Less(i, j int) bool
func (ByDeletions) Swap ¶
func (a ByDeletions) Swap(i, j int)
type Config ¶
func LoadConfig ¶
type ContributorStats ¶
type Maintainer ¶
type MaintainerFile ¶
type MaintainerFile map[string][]*Maintainer
func LoadMaintainerFile ¶
func LoadMaintainerFile(dir string) (MaintainerFile, error)
Currently not being used
func TopMostMaintainerFile ¶
func TopMostMaintainerFile(dir string) (MaintainerFile, error)
Currently not being used
TopMostMaintainerFile moves up the directory tree looking for a MAINTAINERS file, parses the top-most file it finds, and returns its contents. This is used to find the top-level maintainer of a project for certain privileged reviews, such as authorizing changes to a MAINTAINERS file.
type MaintainerManager ¶
type MaintainerManager struct {
// contains filtered or unexported fields
}
Top level type that manages a repository
func NewMaintainerManager ¶
func NewMaintainerManager(client *gh.Client, org, repo string) (*MaintainerManager, error)
func (*MaintainerManager) AddComment ¶
func (m *MaintainerManager) AddComment(number, comment string) (gh.Comment, error)
Add a comment to an existing pull request
func (*MaintainerManager) Checkout ¶
func (m *MaintainerManager) Checkout(pr *gh.PullRequest) error
Checkout the pull request into the working tree of the users repository.
It's up to the caller to decide what to do with the checked out branch - typically created a named branch with 'checkout -b'.
func (*MaintainerManager) Close ¶
func (m *MaintainerManager) Close(number string) error
func (*MaintainerManager) CreatePullRequest ¶
func (m *MaintainerManager) CreatePullRequest(base, head, title, body string) (*gh.PullRequest, error)
func (*MaintainerManager) GetComments ¶
func (m *MaintainerManager) GetComments(number string) ([]gh.Comment, error)
Return all comments for an issue or pull request
func (*MaintainerManager) GetContributors ¶
func (m *MaintainerManager) GetContributors() ([]*gh.Contributor, error)
Return contributors list
func (*MaintainerManager) GetFirstIssue ¶
func (m *MaintainerManager) GetFirstIssue(state, sortBy string) (*gh.Issue, error)
func (*MaintainerManager) GetFirstPullRequest ¶
func (m *MaintainerManager) GetFirstPullRequest(state, sortBy string) (*gh.PullRequest, error)
func (*MaintainerManager) GetFullPullRequests ¶
func (m *MaintainerManager) GetFullPullRequests(prs []*gh.PullRequest, needFullPr, needComments bool) []*gh.PullRequest
func (*MaintainerManager) GetGithubUser ¶
func (m *MaintainerManager) GetGithubUser() (*gh.User, error)
Get the user information from the authenticated user
func (*MaintainerManager) GetIssues ¶
func (m *MaintainerManager) GetIssues(state, assignee string) ([]*gh.Issue, error)
GetIssues queries the GithubAPI for all issues matching the state `state` and the assignee `assignee`. See http://developer.github.com/v3/issues/#list-issues-for-a-repository
func (*MaintainerManager) GetIssuesFound ¶
func (m *MaintainerManager) GetIssuesFound(query string) ([]*gh.SearchItem, error)
Return all issue found
func (*MaintainerManager) GetPullRequest ¶
func (m *MaintainerManager) GetPullRequest(number string) (*gh.PullRequest, error)
Return a single pull request
func (*MaintainerManager) GetPullRequestFiles ¶
func (m *MaintainerManager) GetPullRequestFiles(number string) ([]*gh.PullRequestFile, error)
Return all pull request Files
func (*MaintainerManager) GetPullRequests ¶
func (m *MaintainerManager) GetPullRequests(state, sort string) ([]*gh.PullRequest, error)
Return all pull requests
func (*MaintainerManager) GetStatus ¶
func (m *MaintainerManager) GetStatus(pr *gh.PullRequest) (gh.CombinedStatus, error)
GetStatus queries the GithubAPI for the current build status of a pull request See http://developer.github.com/v3/issues/#list-issues-for-a-repository
func (*MaintainerManager) MergePullRequest ¶
Merge a pull request If no LGTMs are in the comments require force to be true
func (*MaintainerManager) PatchIssue ¶
Patch an issue
func (*MaintainerManager) PatchPullRequest ¶
func (m *MaintainerManager) PatchPullRequest(number string, pr *gh.PullRequest) (*gh.PullRequest, error)
Patch a pull request
func (*MaintainerManager) Repository ¶
func (m *MaintainerManager) Repository() (*gh.Repository, error)