Documentation
¶
Index ¶
- func SeparateLines(fragment *gitdiff.TextFragment) ([]SplitLine, []SplitLine)
- type AncestorCheckResponse
- type Branch
- type Capabilities
- type Commit
- type ConflictInfo
- type Diff
- type DiffFileName
- type DiffFileRenderer
- type DiffFileStat
- type DiffOpts
- type DiffRenderer
- type DiffStat
- type DiffTree
- type ForkInfo
- type ForkStatus
- type FormatPatch
- type LastCommitInfo
- type MergeCheckResponse
- type MergeRequest
- type NiceDiff
- type NiceTree
- type Pipeline
- func (p Pipeline) Counts() map[string]int
- func (p Pipeline) Created() time.Time
- func (p Pipeline) Id() string
- func (p Pipeline) InProgress() bool
- func (p Pipeline) IsResponding() bool
- func (p Pipeline) LongStatusSummary() string
- func (p Pipeline) Sha() string
- func (p Pipeline) ShortStatusSummary() string
- func (p Pipeline) SourceRepo() *string
- func (p Pipeline) Statuses() map[string]WorkflowStatus
- func (p Pipeline) TimeTaken() time.Duration
- func (p Pipeline) Trigger() Trigger
- func (p Pipeline) Valid() bool
- func (p Pipeline) Workflows() []string
- type Reference
- type RepoBranchResponse
- type RepoBranchesResponse
- type RepoCommitResponse
- type RepoDefaultBranchResponse
- type RepoFormatPatchResponse
- type RepoIndexResponse
- type RepoLanguageDetails
- type RepoLanguageResponse
- type RepoLogResponse
- type RepoTagResponse
- type RepoTagsResponse
- type SplitDiff
- type SplitFragment
- type SplitLine
- type StatusKind
- type TagReference
- type Trigger
- type WorkflowStatus
- func (w WorkflowStatus) Created() time.Time
- func (w WorkflowStatus) Error() string
- func (w WorkflowStatus) ErrorDetails() string
- func (w WorkflowStatus) ErrorMessage() string
- func (w WorkflowStatus) Latest() WorkflowStatus
- func (w WorkflowStatus) Status() StatusKind
- func (w WorkflowStatus) TimeTaken() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SeparateLines ¶
func SeparateLines(fragment *gitdiff.TextFragment) ([]SplitLine, []SplitLine)
separate lines into left and right, this includes additional logic to group consecutive runs of additions and deletions in order to align them properly in the final output
TODO: move all diff stuff to a single package, we are spread across patchutil and types right now
Types ¶
type AncestorCheckResponse ¶
type AncestorCheckResponse struct {
Status ForkStatus `json:"status"`
}
type Branch ¶
type Capabilities ¶
type Commit ¶
type Commit struct {
// hash of the commit object.
Hash plumbing.Hash `json:"hash,omitempty"`
// author is the original author of the commit.
Author object.Signature `json:"author"`
// committer is the one performing the commit, might be different from author.
Committer object.Signature `json:"committer"`
// message is the commit message, contains arbitrary text.
Message string `json:"message"`
// treehash is the hash of the root tree of the commit.
Tree string `json:"tree"`
// parents are the hashes of the parent commits of the commit.
ParentHashes []plumbing.Hash `json:"parent_hashes,omitempty"`
// pgpsignature is the pgp signature of the commit.
PGPSignature string `json:"pgp_signature,omitempty"`
// mergetag is the embedded tag object when a merge commit is created by
// merging a signed tag.
MergeTag string `json:"merge_tag,omitempty"`
// changeid is a unique identifier for the change (e.g., gerrit change-id).
ChangeId string `json:"change_id,omitempty"`
// extraheaders contains additional headers not captured by other fields.
ExtraHeaders map[string][]byte `json:"extra_headers,omitempty"`
// deprecated: kept for backwards compatibility with old json format.
This string `json:"this,omitempty"`
// deprecated: kept for backwards compatibility with old json format.
Parent string `json:"parent,omitempty"`
}
func (*Commit) FromGoGitCommit ¶
fill in as much of Commit as possible from the given go-git commit
func (*Commit) Payload ¶
produce a verifiable payload from this commit's metadata
func (*Commit) UnmarshalJSON ¶
types.Commit is an unify two commit structs:
- git.object.Commit from
- types.NiceDiff.commit
to do this in backwards compatible fashion, we define the base struct to use the same fields as NiceDiff.Commit, and then we also unmarshal the struct fields from go-git structs, this custom unmarshal makes sense of both representations and unifies them to have maximal data in either form.
type ConflictInfo ¶
type Diff ¶
type Diff struct {
Name struct {
Old string `json:"old"`
New string `json:"new"`
} `json:"name"`
TextFragments []gitdiff.TextFragment `json:"text_fragments"`
IsBinary bool `json:"is_binary"`
IsNew bool `json:"is_new"`
IsDelete bool `json:"is_delete"`
IsCopy bool `json:"is_copy"`
IsRename bool `json:"is_rename"`
}
func (Diff) Names ¶
func (d Diff) Names() DiffFileName
func (Diff) Stats ¶
func (d Diff) Stats() DiffFileStat
type DiffFileRenderer ¶
type DiffFileRenderer interface {
// html ID for each file in the diff
Id() string
// produce a splitdiff
Split() SplitDiff
// stats for this single file
Stats() DiffFileStat
// old and new name of file
Names() DiffFileName
// whether this diff can be displayed,
// returns a reason if not, and the empty string if it can
CanRender() string
}
type DiffOpts ¶
type DiffRenderer ¶
type DiffRenderer interface {
// list of file affected by these diffs
ChangedFiles() []DiffFileRenderer
// filetree
FileTree() *filetree.FileTreeNode
Stats() DiffStat
}
type DiffStat ¶
type DiffTree ¶
type ForkInfo ¶
type ForkInfo struct {
IsFork bool
Status ForkStatus
}
type ForkStatus ¶
type ForkStatus int
const ( UpToDate ForkStatus = 0 FastForwardable ForkStatus = 1 Conflict ForkStatus = 2 MissingBranch ForkStatus = 3 )
type FormatPatch ¶
type FormatPatch struct {
Files []*gitdiff.File
*gitdiff.PatchHeader
Raw string
}
func (FormatPatch) ChangeId ¶
func (f FormatPatch) ChangeId() (string, error)
func (FormatPatch) ChangeIdOrEmpty ¶
func (f FormatPatch) ChangeIdOrEmpty() string
type LastCommitInfo ¶
type MergeCheckResponse ¶
type MergeCheckResponse struct {
IsConflicted bool `json:"is_conflicted"`
Conflicts []ConflictInfo `json:"conflicts"`
Message string `json:"message"`
Error string `json:"error"`
}
type MergeRequest ¶
type NiceDiff ¶
type NiceDiff struct {
Commit Commit `json:"commit"`
Stat DiffStat `json:"stat"`
Diff []Diff `json:"diff"`
}
A nicer git diff representation.
func (NiceDiff) ChangedFiles ¶
func (d NiceDiff) ChangedFiles() []DiffFileRenderer
func (NiceDiff) FileTree ¶
func (d NiceDiff) FileTree() *filetree.FileTreeNode
type NiceTree ¶
type NiceTree struct {
// Relative path
Name string `json:"name"`
Mode string `json:"mode"`
Size int64 `json:"size"`
LastCommit *LastCommitInfo `json:"last_commit,omitempty"`
}
A nicer git tree representation.
type Pipeline ¶
type Pipeline struct {
*tangled.CiPipeline
}
func (Pipeline) InProgress ¶
InProgress reports whether any workflow in the pipeline is still pending or running (i.e. the pipeline has not fully settled).
func (Pipeline) SourceRepo ¶
where the pipeline commit was checked out from, nil when checked out from repo itself
func (Pipeline) Statuses ¶
func (p Pipeline) Statuses() map[string]WorkflowStatus
type RepoBranchesResponse ¶
type RepoBranchesResponse struct {
Branches []Branch `json:"branches,omitempty"`
}
type RepoCommitResponse ¶
type RepoDefaultBranchResponse ¶
type RepoDefaultBranchResponse struct {
Branch string `json:"branch,omitempty"`
}
type RepoFormatPatchResponse ¶
type RepoFormatPatchResponse struct {
Rev1 string `json:"rev1,omitempty"`
Rev2 string `json:"rev2,omitempty"`
FormatPatch []FormatPatch `json:"format_patch,omitempty"`
FormatPatchRaw string `json:"patch,omitempty"`
CombinedPatch []*gitdiff.File `json:"combined_patch,omitempty"`
CombinedPatchRaw string `json:"combined_patch_raw,omitempty"`
}
type RepoIndexResponse ¶
type RepoLanguageDetails ¶
type RepoLanguageResponse ¶
type RepoLogResponse ¶
type RepoTagResponse ¶
type RepoTagResponse struct {
Tag *TagReference `json:"tag,omitempty"`
}
type RepoTagsResponse ¶
type RepoTagsResponse struct {
Tags []*TagReference `json:"tags,omitempty"`
}
type SplitDiff ¶
type SplitDiff struct {
Name string `json:"name"`
TextFragments []SplitFragment `json:"fragments"`
}
type SplitFragment ¶
type SplitLine ¶
type StatusKind ¶
type StatusKind string
func (StatusKind) IsFinish ¶
func (s StatusKind) IsFinish() bool
func (StatusKind) IsStart ¶
func (s StatusKind) IsStart() bool
func (StatusKind) String ¶
func (s StatusKind) String() string
type TagReference ¶
type Trigger ¶
type Trigger struct {
*tangled.CiPipeline_Trigger
}
type WorkflowStatus ¶
type WorkflowStatus struct {
*tangled.CiPipeline_Workflow
PipelineCreatedAt *string
}
func (WorkflowStatus) Created ¶
func (w WorkflowStatus) Created() time.Time
func (WorkflowStatus) Error ¶
func (w WorkflowStatus) Error() string
func (WorkflowStatus) ErrorDetails ¶
func (w WorkflowStatus) ErrorDetails() string
func (WorkflowStatus) ErrorMessage ¶
func (w WorkflowStatus) ErrorMessage() string
func (WorkflowStatus) Latest ¶
func (w WorkflowStatus) Latest() WorkflowStatus
func (WorkflowStatus) Status ¶
func (w WorkflowStatus) Status() StatusKind
func (WorkflowStatus) TimeTaken ¶
func (w WorkflowStatus) TimeTaken() time.Duration
Source Files
¶
- capabilities.go
- commit.go
- diff.go
- diff_renderer.go
- merge.go
- patch.go
- pipeline.go
- repo.go
- split.go
- tree.go