repo

package
v0.0.0-...-def3303 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package repo implements support for Git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	BundlePath       string   // "~/tmpgis"
	Workspace        string   // "main" or "go-lang"
	User             string   // "jychri"
	Remote           string   // "github" or "gitlab"
	Name             string   // "git-in-sync"
	WorkspacePath    string   // "/Users/jychri/tmpgis/go-lang/"
	RepoPath         string   // "/Users/jychri/tmpgis/go-lang/git-in-sync"
	GitPath          string   // "/Users/jychri/tmpgis/go-lang/git-in-sync/.git"
	GitDir           string   // "--git-dir=/Users/jychri/tmpgis/go-lang/git-in-sync/.git"
	WorkTree         string   // "--work-tree=/Users/jychri/tmpgis/go-lang/git-in-sync"
	URL              string   // "https://github.com/jychri/git-in-sync"
	PendingClone     bool     // true if RepoPath or GitPath are empty
	Verified         bool     // true if Repo continues to pass verification
	ErrorMessage     string   // the last error message
	ErrorName        string   // name of the last error
	ErrorShort       string   // message in matched short form
	Cloned           bool     // true if Repo was cloned
	OriginURL        string   // "https://github.com/jychri/git-in-sync"
	LocalBranch      string   // `git rev-parse --abbrev-ref HEAD`, "master"
	LocalSHA         string   // `git rev-parse @`, "l00000ngSHA1slong324"
	UpstreamSHA      string   // `git rev-parse @{u}`, "l00000ngSHA1slong324"
	MergeSHA         string   // `git merge-base @ @{u}`, "l00000ngSHA1slong324"
	UpstreamBranch   string   // `git rev-parse --abbrev-ref --symbolic-full-name @{u}`, "..."
	DiffsNameOnly    []string // `git diff --name-only @{u}`, [a, b, c, d, e]
	DiffsSummary     string   // "a, b, c..."
	ShortStat        string   // `git diff --shortstat`, "x files changed, y insertions(+), z deletions(-)"
	Changed          int      // count of changed files (x)
	Insertions       int      // count of inserted files (y)
	Deletions        int      // count of deleted files (z)
	ShortStatSummary string   // "+y|-z" or "D" for Deleted if (x >= 1 && y == 0 && z == 0)
	Clean            bool     // true if Changed, Insertions and Deletions are all 0
	Untracked        bool     // true if if len(r.UntrackedFiles) >= 1
	UntrackedFiles   []string // `git ls-files --others --exclude-standard`, [a, b, c, d, e]
	UntrackedSummary string   // "a, b, c..."
	Category         string   // Complete, Pending, Skipped, Scheduled
	Status           string   // Complete is the last step
	Action           string   // Push, Pull, Add-Commit-Push etc.
	Prompt1          string   // First prompt message
	Prompt2          string   // Second prompt message
	Message          string   // Commit message
}

Repo models a Git repository.

func Init

func Init(workspace string, user string, remote string, bundle string, name string) *Repo

Init returns an initialized *Repo.

func (*Repo) Error

func (r *Repo) Error(dsc string, em string)

Error records and evaluates last error.

func (*Repo) GitAbbrevRef

func (r *Repo) GitAbbrevRef()

GitAbbrevRef ...

func (*Repo) GitAdd

func (r *Repo) GitAdd(f flags.Flags)

GitAdd ...

func (*Repo) GitClear

func (r *Repo) GitClear()

GitClear ...

func (*Repo) GitClone

func (r *Repo) GitClone(f flags.Flags)

GitClone clones a Git repository from r.URL.

func (*Repo) GitCommit

func (r *Repo) GitCommit(f flags.Flags)

GitCommit ...

func (*Repo) GitConfigOriginURL

func (r *Repo) GitConfigOriginURL()

GitConfigOriginURL gets the remote origin URL for a Repo.

func (*Repo) GitDiffsNameOnly

func (r *Repo) GitDiffsNameOnly()

GitDiffsNameOnly ...

func (*Repo) GitLocalSHA

func (r *Repo) GitLocalSHA()

GitLocalSHA ...

func (*Repo) GitMergeBaseSHA

func (r *Repo) GitMergeBaseSHA()

GitMergeBaseSHA ...

func (*Repo) GitPop

func (r *Repo) GitPop(f flags.Flags)

GitPop ...

func (*Repo) GitPull

func (r *Repo) GitPull(f flags.Flags)

GitPull ...

func (*Repo) GitPush

func (r *Repo) GitPush(f flags.Flags)

GitPush ...

func (*Repo) GitRemoteUpdate

func (r *Repo) GitRemoteUpdate()

GitRemoteUpdate ...

func (*Repo) GitRevParseUpstream

func (r *Repo) GitRevParseUpstream()

GitRevParseUpstream ...

func (*Repo) GitSchedule

func (r *Repo) GitSchedule(f flags.Flags, st *stat.Stat)

GitSchedule ...

func (*Repo) GitShortstat

func (r *Repo) GitShortstat()

GitShortstat ...

func (*Repo) GitStash

func (r *Repo) GitStash(f flags.Flags)

GitStash ...

func (*Repo) GitUntracked

func (r *Repo) GitUntracked()

GitUntracked ...

func (*Repo) GitUpstreamBranch

func (r *Repo) GitUpstreamBranch()

GitUpstreamBranch ...

func (*Repo) SetStatus

func (r *Repo) SetStatus(f flags.Flags)

SetStatus ...

func (*Repo) UserConfirm

func (r *Repo) UserConfirm(f flags.Flags)

UserConfirm prompts the user with prompts Prompt1 and Prompt2 and records the response.

func (*Repo) VerifyWorkspace

func (r *Repo) VerifyWorkspace(f flags.Flags, st *stat.Stat)

VerifyWorkspace verifies that the r.WorkspacePath is present and accessible.

Jump to

Keyboard shortcuts

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