git

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActionStatus     = &Action{Key: "status", Title: "Status", Description: "Returns the status of the repository"}
	ActionCreateRepo = &Action{Key: "createrepo", Title: "Create Repo", Description: "Creates a git repo and makes an initial commit"}
	ActionMagic      = &Action{Key: "magic", Title: "Magic", Description: "Does everything it can to bring the repo up to date (stash, pull, pop, commit, push)"}
	ActionFetch      = &Action{Key: "fetch", Title: "Fetch", Description: "Fetches the latest changes from the repository"}
	ActionCommit     = &Action{Key: "commit", Title: "Commit", Description: "Adds all files, commits with the provided message"}
	ActionPull       = &Action{Key: "pull", Title: "Pull", Description: "Pulls pending commits from upstream"}
	ActionPush       = &Action{Key: "push", Title: "Push", Description: "Pushes pending commits to the remote"}
	ActionReset      = &Action{Key: "reset", Title: "Reset", Description: "Resets all local changes; be careful"}
	ActionBranch     = &Action{Key: "branch", Title: "Branch", Description: "Switch to a new branch"}
	ActionUndoCommit = &Action{Key: "undocommit", Title: "Undo", Description: "Removes the most recent commit, keeping all local changes"}
	ActionOutdated   = &Action{Key: "outdated", Title: "Outdated", Description: "Finds commits since last tag"}
	ActionHistory    = &Action{Key: "history", Title: "History", Description: "Visualize the git history"}
)
View Source
var ResultFields = []string{"Project", "Status", "Data", "Error"}

Functions

This section is empty.

Types

type Action

type Action struct {
	Key         string `json:"key"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

func ActionStatusFromString

func ActionStatusFromString(key string) *Action

type Actions

type Actions []*Action

type HistoryEntries added in v0.9.17

type HistoryEntries []*HistoryEntry

func ParseResultsDelimited added in v0.9.17

func ParseResultsDelimited(output string) (HistoryEntries, error)

func (HistoryEntries) Get added in v0.9.22

func (h HistoryEntries) Get(sha string) *HistoryEntry

type HistoryEntry added in v0.9.17

type HistoryEntry struct {
	Headers     util.ValueMap `json:"headers" xml:"headers"`
	SHA         string        `json:"sha" xml:"sha"`
	AuthorName  string        `json:"authorName" xml:"authorName"`
	AuthorEmail string        `json:"authorEmail" xml:"authorEmail"`
	Message     string        `json:"message" xml:"message"`
	Occurred    string        `json:"occurred" xml:"occurred"`
	Files       HistoryFiles  `json:"files" xml:"files"`
}

func (*HistoryEntry) OccurredTime added in v0.9.17

func (h *HistoryEntry) OccurredTime() *time.Time

type HistoryFile added in v0.9.17

type HistoryFile struct {
	Status string
	File   string
}

type HistoryFiles added in v0.9.17

type HistoryFiles []*HistoryFile

type HistoryResult added in v0.9.17

type HistoryResult struct {
	Path    string         `json:"path,omitempty"`
	Since   *time.Time     `json:"since,omitempty"`
	Authors []string       `json:"authors,omitempty"`
	Limit   int            `json:"limit,omitempty"`
	Commit  string         `json:"commit,omitempty"`
	Entries HistoryEntries `json:"entries"`
	Debug   any            `json:"debug,omitempty"`
}

type Result

type Result struct {
	Project *project.Project `json:"-"`
	Status  string           `json:"status"`
	Data    util.ValueMap    `json:"data"`
	Error   string           `json:"error"`
}

func NewResult

func NewResult(prj *project.Project, status string, data util.ValueMap) *Result

func (*Result) Actions

func (r *Result) Actions() Actions

func (*Result) CleanData added in v0.9.22

func (r *Result) CleanData() util.ValueMap

func (*Result) DataInt

func (r *Result) DataInt(k string) int

func (*Result) DataString

func (r *Result) DataString(k string) string

func (*Result) DataStringArray

func (r *Result) DataStringArray(k string) []string

func (*Result) History added in v0.9.17

func (r *Result) History() *HistoryResult

func (*Result) Strings added in v1.1.0

func (r *Result) Strings() []string

func (*Result) ToCSV added in v1.1.0

func (r *Result) ToCSV() ([]string, [][]string)

type Results

type Results []*Result

func (Results) Get

func (r Results) Get(key string) *Result

func (Results) ToCSV added in v1.1.0

func (r Results) ToCSV() ([]string, [][]string)

type Service

type Service struct{}

func NewService

func NewService() *Service

func (*Service) Commit

func (s *Service) Commit(ctx context.Context, prj *project.Project, msg string, logger util.Logger) (*Result, error)

func (*Service) CreateRepo

func (s *Service) CreateRepo(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) Fetch

func (s *Service) Fetch(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) History added in v0.9.17

func (s *Service) History(ctx context.Context, prj *project.Project, hist *HistoryResult, logger util.Logger) (*Result, error)

func (*Service) Magic

func (s *Service) Magic(ctx context.Context, prj *project.Project, message string, dryRun bool, logger util.Logger) (*Result, error)

func (*Service) Outdated added in v0.7.9

func (s *Service) Outdated(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) Pull

func (s *Service) Pull(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) Push

func (s *Service) Push(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) Reset added in v1.2.18

func (s *Service) Reset(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) Status

func (s *Service) Status(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

func (*Service) UndoCommit

func (s *Service) UndoCommit(ctx context.Context, prj *project.Project, logger util.Logger) (*Result, error)

Jump to

Keyboard shortcuts

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