branches

package
v3.1.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	// ID of the branch hash(Commits[0] + Name)
	// More stable id that allows name reuse after deletes.
	// Only set for branches.
	BranchID string

	// Name of the branch
	Name string

	// IsPullRequest is set to true if this is created based on passed pull request sha instead of repo branch.
	IsPullRequest bool

	// HeadSHA is the sha of the head commit.
	HeadSHA string

	// IsDefault is true if this is default branch of the repo. Typically true for master.
	IsDefault bool

	// IsMerged is true if this branch was merged into default branch
	IsMerged bool

	// MergeCommit is the hash of the merged commit. Set if IsMerged=true
	MergeCommit string

	// BranchedFromCommits are the branch points where the branch was originally created from master.
	// If the master was merged into branch multiple times, only oldest commit intersecting with master is used.
	// If the branch was started from multiple branches that are now the current master, this will contain array of them.
	// Normally this should be len(1)
	// In case the branch is completely separate and does not have commit commits with master it will be len(0)
	BranchedFromCommits []string

	// Commits is the list of hashes.
	// Does not include commits that were on master before it was created.
	// Could be empty.
	//
	// Commits[0] is the first commit on this branch
	// Commits[len-1] is the last commit on this branch
	Commits []string

	// BehindDefaultCount is the number of commits on master that are not in this branch.
	// If the branch isMerged = true the value is 0.
	BehindDefaultCount int

	// AheadDefaultCount is the number of commits made to this branch, not including commits on master.
	// Same as len(Commits)
	AheadDefaultCount int

	// FirstCommit is the first commit on this branch
	FirstCommit string
}

Branch contains information about the branch or pull request, for example commits.

type Opts

type Opts struct {
	Logger hclog.Logger
	// Logger outputs logs.
	//Logger logger.Logger
	// IncludeDefaultBranch if default branch should be included in results.
	IncludeDefaultBranch bool
	// Concurrency sets number of goroutines that process tree.
	Concurrency int
	// RepoDir is location of git repo.
	RepoDir string
	// CommitGraph is the full graph of commits.
	CommitGraph *parentsgraph.Graph
	// PullRequestSHAs is a list of custom sha references to process similar to branches returned from the repo.
	PullRequestSHAs []string
	// PullRequestsOnly skips branch data output, only using passed PullRequestSHAs
	PullRequestsOnly bool
}

type Process

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

func New

func New(opts Opts) *Process

func (*Process) Run

func (s *Process) Run(ctx context.Context, res chan Branch) error

func (*Process) RunSlice

func (s *Process) RunSlice(ctx context.Context) (res []Branch, _ error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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