gordon

package module
v0.0.0-...-a2d6ca3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2014 License: MIT Imports: 20 Imported by: 0

README

Pulls

Pulls is a small cli application name to help you manage pull requests for your repository. It was created by Michael Crosby to improve the productivity of the Docker maintainers.

Quick installation instructions:

  • Install Go from http://golang.org/
  • Install with go get github.com/dotcloud/gordon/{pulls,issues}
  • Make sure your $PATH includes x/bin where x is each directory in your $GOPATH environment variable.
  • Call pulls --help and issues --help
  • Add your github token with pulls auth --add <token>

Documentation

Index

Constants

View Source
const MaintainerManagersFileName = "MAINTAINERS"

Variables

This section is empty.

Functions

func DisplayCommentAdded

func DisplayCommentAdded(cmt gh.Comment)

func DisplayComments

func DisplayComments(comments []gh.Comment)

func DisplayContributors

func DisplayContributors(c *cli.Context, contributors []*gh.Contributor)

func DisplayIssue

func DisplayIssue(issue *gh.Issue, comments []gh.Comment)

func DisplayIssues

func DisplayIssues(c *cli.Context, v interface{}, notrunc bool)

Display Issues prints `issues` to standard output in a human-friendly tabulated format.

func DisplayPatch

func DisplayPatch(r io.Reader) error

func DisplayPullRequest

func DisplayPullRequest(pr *gh.PullRequest, comments []gh.Comment)

func DisplayPullRequests

func DisplayPullRequests(c *cli.Context, pulls []*gh.PullRequest, notrunc bool)

func DisplayReviewers

func DisplayReviewers(c *cli.Context, reviewers map[string][]*Maintainer)

func GetMaintainerManagerEmail

func GetMaintainerManagerEmail() (string, error)

func GetOriginUrl

func GetOriginUrl() (string, string, error)

func Git

func Git(args ...string) error

Execute git commands and output to Stdout and Stderr

func HumanDuration

func HumanDuration(d time.Duration) string

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 ReviewPatch

func ReviewPatch(src io.Reader, maintainersDirMap *map[string][]*Maintainer) (reviewers map[string][]*Maintainer, err error)

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

func SaveConfig(config Config) error

func WriteError

func WriteError(format string, err error)

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

func (ByCommits) Len

func (a ByCommits) Len() int

func (ByCommits) Less

func (a ByCommits) Less(i, j int) bool

func (ByCommits) Swap

func (a ByCommits) Swap(i, j int)

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

type Config struct {
	Token    string
	UserName string
}

func LoadConfig

func LoadConfig() (*Config, error)

type ContributorStats

type ContributorStats struct {
	Name      string
	Additions int
	Deletions int
	Commits   int
}

type Maintainer

type Maintainer struct {
	Username string
	FullName string
	Email    string
	Target   string
	Active   bool
	Lead     bool
	Raw      string
}

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. This will mimic the operations on the manual merge view

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) GetGithubUser

func (m *MaintainerManager) GetGithubUser() (*gh.User, error)

Get the user information from the authenticated user

func (*MaintainerManager) GetIssue

func (m *MaintainerManager) GetIssue(number string, comments bool) (*gh.Issue, []gh.Comment, error)

Return a single issue Return issue's comments if requested

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) GetMaintainersDirMap

func (m *MaintainerManager) GetMaintainersDirMap() *map[string][]*Maintainer

func (*MaintainerManager) GetPullRequest

func (m *MaintainerManager) GetPullRequest(number string, comments bool) (*gh.PullRequest, []gh.Comment, error)

Return a single pull request Return pr's comments if requested

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) GetPullRequestsThatICareAbout

func (m *MaintainerManager) GetPullRequestsThatICareAbout(showAll bool, state, sortQuery string) ([]*gh.PullRequest, error)

Return all the pull requests that I care about

func (*MaintainerManager) IsMaintainer

func (m *MaintainerManager) IsMaintainer(userName string) bool

func (*MaintainerManager) MergePullRequest

func (m *MaintainerManager) MergePullRequest(number, comment string, force bool) (gh.Merge, error)

Merge a pull request If no LGTMs are in the comments require force to be true

func (*MaintainerManager) PatchIssue

func (m *MaintainerManager) PatchIssue(number string, issue *gh.Issue) (*gh.Issue, error)

Patch an issue

func (*MaintainerManager) Repository

func (m *MaintainerManager) Repository() (*gh.Repository, error)

type MaintainerManagerDirectoriesMap

type MaintainerManagerDirectoriesMap struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL