types

package
v0.0.0-...-50f4daa Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SegmentTypeContext = "CONTEXT"
	SegmentTypeRemoved = "REMOVED"
	SegmentTypeAdded   = "ADDED"
)

Variables

This section is empty.

Functions

func Note

func Note(String string) string

Types

type Changeset

type Changeset struct {
	FromHash   string
	ToHash     string
	Path       string
	Whitespace string
	Diffs      []*Diff
}

func (Changeset) ForEachComment

func (r Changeset) ForEachComment(callback func(*Diff, *Comment, *Comment))

func (Changeset) ForEachLine

func (r Changeset) ForEachLine(
	callback func(*Diff, *Hunk, *Segment, *Line) error,
) error

type Comment

type Comment struct {
	Id          int64
	Version     int
	Text        string
	CreatedDate UnixTimestamp
	UpdatedDate UnixTimestamp
	Comments    CommentsTree
	Author      struct {
		Name         string
		EmailAddress string
		Id           int
		DisplayName  string
		Active       bool
		Slug         string
		Type         string
	}

	Anchor CommentAnchor

	PermittedOperations struct {
		Editable  bool
		Deletable bool
	}

	Indent   int
	Parented bool
}

func (Comment) Short

func (c Comment) Short(length int) string

type CommentAnchor

type CommentAnchor struct {
	FromHash string
	ToHash   string
	Line     int64  `json:"line"`
	LineType string `json:"lineType"`
	Path     string `json:"path"`
	SrcPath  string `json:"srcPath"`
	FileType string `json:"fileType"`
}

type CommentsTree

type CommentsTree []*Comment

type Diff

type Diff struct {
	Truncated bool
	Source    struct {
		Parent   string
		Name     string
		ToString string
	}
	Destination struct {
		Parent   string
		Name     string
		ToString string
	}
	Hunks []*Hunk

	FileComments CommentsTree
	LineComments CommentsTree

	Note string

	// Lists made only for Stash API compatibility.
	// TODO: move it to `ash`.
	Attributes struct {
		FromHash []string
		ToHash   []string
	}
}

func (Diff) ForEachLine

func (d Diff) ForEachLine(
	callback func(*Diff, *Hunk, *Segment, *Line) error,
) error

func (Diff) GetHashFrom

func (d Diff) GetHashFrom() string

func (Diff) GetHashTo

func (d Diff) GetHashTo() string

type Hunk

type Hunk struct {
	SourceLine      int64
	SourceSpan      int64
	DestinationLine int64
	DestinationSpan int64
	Truncated       bool
	Segments        []*Segment
}

type Line

type Line struct {
	Destination    int64
	Source         int64
	Line           string
	Truncated      bool
	ConflictMarker string
	CommentIds     []int64
	Comments       CommentsTree
}

type Segment

type Segment struct {
	Type      string
	Truncated bool
	Lines     []*Line
}

func (Segment) GetLineNum

func (s Segment) GetLineNum(l *Line) int64

func (Segment) TextPrefix

func (s Segment) TextPrefix() string

type UnixTimestamp

type UnixTimestamp int

func (UnixTimestamp) String

func (u UnixTimestamp) String() string

Jump to

Keyboard shortcuts

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