Documentation ¶
Index ¶
- Constants
- Variables
- func Checkout(client *Client, repoOwner, repoName, repoUrl string) (string, error)
- func Commit(client *Client, repoOwner, repoName, message string) (*git2go.Oid, error)
- func ContainsFile(client *Client, gr *GitRepo) (bool, error)
- func ContributeToRepo(client *Client, repoUserAndName string, private bool, ...) error
- func CreateFile(client *Client, user, repoOwner, repoName, path string, content []byte) error
- func DeleteFile(client *Client, user, repoOwner, repoName, path string) error
- func DeltaToString(d git2go.Delta) string
- func DiffDeltaPath(dd git2go.DiffDelta) string
- func DiffFlagToString(f git2go.DiffFlag) string
- func DiskSpaceFree() (uint64, error)
- func DuplicateRepo(client *Client, githubPassword string, templateRepo string, orgName string, ...) error
- func FetchRemote(repo *git2go.Repository, remoteName string) (*git2go.Remote, error)
- func FetchRemoteForRepo(client *Client, repoOwner, repoName, remoteName string) (*git2go.Remote, error)
- func FetchRemoteForRepoDir(client *Client, repoDir string, remoteName string) (*git2go.Remote, error)
- func FileExistsInWorkingDir(client *Client, repoOwner, repoName, path string) (bool, error)
- func FileRenameInWorkingDir(client *Client, repoOwner, repoName, fromPath, toPath string) error
- func FreeCommitSlice(commits []*git2go.Commit)
- func GetFile(client *Client, user, repoOwner, repoName, path string) ([]byte, error)
- func GetFileSHA(client *Client, user, repoOwner, repoName, path string) (*string, error)
- func GetPullRequest(client *Client, user, repoOwner, repoName string, number int) (*github.PullRequest, error)
- func GetUserForDir(d string) (user, token string, err error)
- func GitCloneTo(client *Client, workingDir string, repoUsername, repoName string) error
- func GitCurrentBranch(clinet *Client, workingDir string) (string, error)
- func GitFindRepoRootDirectory(workingDir string) (string, error)
- func GitMergeAnalysisToString(a git2go.MergeAnalysis) string
- func GitMergePreferenceToString(a git2go.MergePreference) string
- func GitNotExistError(err error) bool
- func GitRemoteRepo(workingDir, remote string) (remoteUser, remoteProject string, err error)
- func GitRepositoryStateToString(state git2go.RepositoryState) string
- func GitStatusToString(status git2go.Status) string
- func GithubDeleteRepo(apiToken string, githubUsername string, repoName string) error
- func GithubPaginate(list *github.ListOptions, get func() (*github.Response, error)) error
- func GithubTokenFromWebRequest(r *http.Request) (string, error)
- func HashFile(fn string) (string, error)
- func ListFiles(client *Client, user, repoOwner, repoName, pathRegexp string) ([]string, error)
- func ListPullRequests(client *Client, repoOwner, repoName string) ([]*github.PullRequest, error)
- func PrintPdf(client *Client, user, repo string) (string, error)
- func PullRequestClose(client *Client, repoOwner, repoName string, number int) error
- func PullRequestDir(sha string) (string, error)
- func PullRequestRemoteName(pr *github.PullRequest) string
- func PullRequestUpdate(client *Client, user, repoOwner, repoName string, sha string, path string, ...) error
- func PullRequestVersions(client *Client, ...) (string, string, error)
- func RemoteAdd(client *Client, user, repoOwner, repoName, remoteUrl string) (string, error)
- func RemoteName(remoteUrl string) string
- func RepoDir(user, repoOwner, repoName string) (string, error)
- func SaveWorkingFile(client *Client, repoOwner, repoName, path string, content []byte) error
- func StageFile(client *Client, repoOwner, repoName, path string) error
- func StatusEntryStatusToString(s git2go.Status) string
- func UpdateFile(client *Client, user, repoOwner, repoName, path string, content []byte) error
- func UrlUserRepo(remoteUrl string) (string, string, error)
- func Username(client *Client) (string, error)
- type Client
- func ClientFromCLIConfig() (*Client, error)
- func ClientFromCLIConfigAlias(name string) (*Client, error)
- func ClientFromCLIConfigNamed(name string) (*Client, error)
- func ClientFromUsernamePassword(username, password string) (*Client, error)
- func ClientFromWebRequest(w http.ResponseWriter, r *http.Request) (*Client, error)
- type CommitInfo
- type ConflictWalkFunc
- type DiffDelta
- type DiffDeltaType
- type Directory
- func (d *Directory) Filter(base string, filter func(fullname string) bool) DirectoryEntry
- func (d *Directory) IsDirectory() bool
- func (d *Directory) Map() map[string]interface{}
- func (d *Directory) MarshalJSON() ([]byte, error)
- func (d *Directory) Name() string
- func (d *Directory) ReadDirectory(base string) error
- type DirectoryEntry
- type EBWRepoStatus
- type File
- type FileDiff
- type FileInfo
- type FileTree
- func (ft *FileTree) Cleanup() error
- func (ft *FileTree) Exists(path string) (bool, error)
- func (ft *FileTree) Read(path string) ([]byte, error)
- func (ft *FileTree) Remove(path string) error
- func (ft *FileTree) Sync(r *Repo, version FileVersion) error
- func (ft *FileTree) Write(path string, data []byte) error
- type FileVersion
- type Git
- func (g *Git) AddAllStagedFilesToIndex() error
- func (g *Git) AddAuth(origUrl string) (string, error)
- func (g *Git) AddRemote(remoteName, cloneURL string) error
- func (g *Git) AddToIndex(path string) error
- func (g *Git) AheadBehind(remoteName string) (int, int, error)
- func (g *Git) CatFileVersion(path string, v GitFileVersion, auto *bool) ([]byte, error)
- func (g *Git) Close() error
- func (g *Git) Commit(message string) (*git2go.Oid, error)
- func (g *Git) CommitFileDiffs(oldObject, newObject *git2go.Object) ([]*FileDiff, error)
- func (g *Git) ConflictFileDiffs(oldCommitObject, newCommitObject *git2go.Object) error
- func (g *Git) DefaultSignature() (*git2go.Signature, error)
- func (g *Git) Error(err error) error
- func (g *Git) ExistsFileVersion(path string, v GitFileVersion, auto *bool) (bool, error)
- func (g *Git) FetchRefspecs(remoteName string) ([]string, error)
- func (g *Git) FetchRemote(remoteName string) error
- func (g *Git) GetBranch(remoteBranch string) (*git2go.Object, error)
- func (g *Git) GetUpstreamRemote() (user string, name string, err error)
- func (g *Git) GetUpstreamRemoteActions() (GitRemoteAction, error)
- func (g *Git) GithubClient() (*github.Client, error)
- func (g *Git) GithubClosePullRequest(merged bool) error
- func (g *Git) GithubRemote(remoteName string) (*GithubRemote, error)
- func (g *Git) GithubRepo() (*github.Repository, error)
- func (g *Git) GithubUser() (*github.User, error)
- func (g *Git) HasConflicts() (bool, error)
- func (g *Git) HasUpstreamRemote() (bool, error)
- func (g *Git) Infof(fmt string, args ...interface{})
- func (g *Git) IsFileConflicted(path string) (bool, error)
- func (g *Git) IsMerging() bool
- func (g *Git) IsOurHeadInWd(path string) (bool, error)
- func (g *Git) ListConflictedFiles() ([]string, error)
- func (g *Git) ListDiffsIndexToWt() ([]*DiffDelta, error)
- func (g *Git) MergeAnalysis(remoteName string) (git2go.MergeAnalysis, git2go.MergePreference, error)
- func (g *Git) MergeBranch(remoteName string, resolve MergeResolution) (bool, error)
- func (g *Git) MergeCanFastForward(remoteName string) (bool, error)
- func (g *Git) MergePullRequest(pullRequestNumber int, remoteName, pullRequestSHA string) error
- func (g *Git) MergingFilesList() ([]*IndexFileStatusAbbreviated, error)
- func (g *Git) MergingPRNumber() (int, error)
- func (g *Git) Path(path ...string) string
- func (g *Git) PathEBWConfig(path ...string) string
- func (g *Git) PathTheir(path ...string) string
- func (g *Git) PrintEBWRepoStatus(out io.Writer)
- func (g *Git) PullAbort(closePullRequest bool) error
- func (g *Git) PullOrigin() error
- func (g *Git) PullUpstream() error
- func (g *Git) Push(remoteName, remoteBranch string) error
- func (g *Git) RemoteUser(remoteName string) (string, string, error)
- func (g *Git) RemoveConflict(path string) error
- func (g *Git) RepoState() *GitRepoState
- func (g *Git) SHAHead() (string, error)
- func (g *Git) SHARemote(remoteName string, fetch bool) (string, error)
- func (g *Git) SetRemoteUserPassword(remoteName, username, password string) error
- func (g *Git) SetUpstreamRemote() error
- func (g *Git) SetUsernameEmail(name, email string) error
- func (g *Git) StagedFiles() ([]*IndexFileStatus, error)
- func (g *Git) UpdateRemoteGithubIdentity(username, password string) error
- func (g *Git) WalkConflicts(f ConflictWalkFunc) error
- func (g *Git) WriteVersionToWd(path string, v GitFileVersion) error
- type GitFileVersion
- type GitRemoteAction
- type GitRepo
- type GitRepoState
- type GithubInvitation
- type GithubRemote
- type IndexFileStatus
- type IndexFileStatusAbbreviated
- type MergeFileInfo
- type MergeFileResolutionState
- type MergeResolution
- type PullRequest
- type PullRequestDiff
- func GetPathDiff(localRoot, remoteRoot, path string) (*PullRequestDiff, error)
- func GetPathDiffList(localPath, remotePath string, pathRegexp string) ([]*PullRequestDiff, error)
- func PullRequestDiffList(client *Client, repoOwner, repoName string, pr *github.PullRequest) ([]*PullRequestDiff, error)
- func PullRequestDiffListByNumber(client *Client, repoOwner, repoName string, prNumber int) ([]*PullRequestDiff, error)
- type PullRequestInfo
- type Repo
- func (r *Repo) AddAllStagedFilesToIndex() error
- func (r *Repo) AddRemote(remoteName string, remoteCloneURL string) error
- func (r *Repo) AddToIndex(path string) error
- func (r *Repo) AutoProcessState() (bool, error)
- func (r *Repo) BranchCreate(name string, force bool) (string, *git2go.Oid, error)
- func (r *Repo) CLI() bool
- func (r *Repo) CanCreatePR() (bool, error)
- func (r *Repo) CanPush() (bool, error)
- func (r *Repo) Checkout() error
- func (r *Repo) Cleanup() error
- func (r *Repo) CleanupConflictTemporaryFiles() error
- func (r *Repo) Close()
- func (r *Repo) CloseConflict(message, notes string) error
- func (r *Repo) Commit(message string, notes string) (*git2go.Oid, error)
- func (r *Repo) CommitAll(message, notes string) (*git2go.Oid, error)
- func (r *Repo) CommitIfNoConflicts() (bool, error)
- func (r *Repo) ConfigPath(path ...string) string
- func (r *Repo) DiffsIndexToWt() ([]*DiffDelta, error)
- func (r *Repo) DumpIndex() error
- func (r *Repo) Error(err error) error
- func (r *Repo) Errorf(formatter string, args ...interface{}) error
- func (r *Repo) FetchRemote(remoteName string) error
- func (r *Repo) FileBlob(fileId *git2go.Oid) ([]byte, error)
- func (r *Repo) FileCat(path string, version FileVersion) (bool, []byte, error)
- func (r *Repo) FileGit(path string) (automergeable bool, raw []byte, err error)
- func (r *Repo) FileInfoFromIndex(path string) (*FileInfo, error)
- func (r *Repo) GetRepoState() (RepoState, error)
- func (r *Repo) GetUpstreamPullRequestsCount() (int, error)
- func (r *Repo) GithubRepo() (*github.Repository, error)
- func (r *Repo) HasConflictedFiles() (bool, error)
- func (r *Repo) HasUpstreamRemote() (bool, error)
- func (r *Repo) IndexEntry(path string) (*git2go.IndexEntry, error)
- func (r *Repo) Infof(format string, args ...interface{})
- func (r *Repo) IsFileConflicted(path string) (bool, error)
- func (r *Repo) ListConflictedFiles() ([]string, error)
- func (r *Repo) ListRepoConflicts() ([]*RepoConflict, error)
- func (r *Repo) MergeCommits(includeHead bool) ([]*git2go.Commit, error)
- func (r *Repo) MergeFileInfo(path string) (*MergeFileInfo, error)
- func (r *Repo) MergeFileResolutionState(path string) (MergeFileResolutionState, error)
- func (r *Repo) MergeWith(remote, branch string, resolve ResolveMergeOption, conflicted bool, ...) error
- func (r *Repo) MergingFilesList() ([]*IndexFileStatusAbbreviated, error)
- func (r *Repo) MergingPRNumber() (int, error)
- func (r *Repo) MustRepoState() RepoState
- func (r *Repo) PrintLocalChanges() error
- func (r *Repo) PrintStatusList() error
- func (r *Repo) Pull(remoteName, branchName string) error
- func (r *Repo) PullAbort(closePullRequest bool) error
- func (r *Repo) PullOrigin() error
- func (r *Repo) PullPR(prNumber int) error
- func (r *Repo) PullRequest(number int) (*github.PullRequest, error)
- func (r *Repo) PullRequestClose(number int, merged bool) error
- func (r *Repo) PullRequestCreate(title, notes string) (int, error)
- func (r *Repo) PullRequestFetch(number int, pr *github.PullRequest) error
- func (r *Repo) PullRequestList() ([]*github.PullRequest, error)
- func (r *Repo) PullRequestMerge(number int) error
- func (r *Repo) PullUpstream() error
- func (r *Repo) Push(remoteName, branchName string) error
- func (r *Repo) PushOrigin() error
- func (r *Repo) RepoOwnerAndName() (string, string, error)
- func (r *Repo) RepoPath(path ...string) string
- func (r *Repo) RepoStateString() (string, error)
- func (r *Repo) RepoStateStringNoError() string
- func (r *Repo) ResetConflictedFilesInWorkingDir(chooseOurs, conflictedOnly bool, ...) error
- func (r *Repo) ResetState()
- func (r *Repo) RevertDiffDelta(rd *DiffDelta) error
- func (r *Repo) RevertLocalChanges() error
- func (r *Repo) RunGit(args ...string) error
- func (r *Repo) SearchForFiles(fn string, filter func(in string) bool) ([]string, error)
- func (r *Repo) SetUpstreamRemote() error
- func (r *Repo) StagedFiles() ([]*IndexFileStatus, error)
- func (r *Repo) StagedFilesAbbreviated() ([]*IndexFileStatusAbbreviated, error)
- func (r *Repo) Stash(msg string) (*git2go.Oid, error)
- func (r *Repo) StatusCount() (int, int, error)
- func (r *Repo) StatusList() (*git2go.StatusList, error)
- func (r *Repo) StatusListFilenames() ([]string, error)
- func (r *Repo) TheirPath(path ...string) string
- func (r *Repo) TheirTree() *FileTree
- func (r *Repo) Unstash() error
- func (r *Repo) UpdateFileBinary(path string, raw []byte) error
- func (r *Repo) WorkingTree() *FileTree
- type RepoConflict
- type RepoDiffStats
- type RepoState
- func (rs RepoState) LocalAhead() bool
- func (rs RepoState) LocalBehind() bool
- func (rs RepoState) LocalChanges() bool
- func (rs RepoState) LocalChangesStaged() bool
- func (rs RepoState) LocalChangesUnstaged() bool
- func (rs RepoState) LocalConflicted() bool
- func (rs RepoState) LocalInSync() bool
- func (rs RepoState) LocalUnimplemented() bool
- func (rs RepoState) ParentAhead() bool
- func (rs RepoState) ParentBehind() bool
- func (rs RepoState) ParentInSync() bool
- func (rs RepoState) ParentNotExist() bool
- func (rs RepoState) String() string
- type ResolveMergeOption
- type StatusEntry
- type StatusList
Constants ¶
const ( GFV_ANCESTOR GitFileVersion = 1 GFV_OUR_HEAD = 2 GFV_THEIR_HEAD = 3 GFV_OUR_WD = 4 GFV_THEIR_WD = 5 GFV_GIT_MERGED = 6 GFV_INDEX = 7 )
const ( MergeFileError = 0 MergeFileResolved = 1 MergeFileModified = 2 MergeFileNew = 3 MergeFileDeleted = 4 MergeFileConflict = 5 )
const ( FileAncestor FileVersion = 1 FileOur = 2 FileTheir = 3 FileWorking = 4 FileMerge = 5 )
const ( // The EMB system is in-sync with its Github repo EBMInSync = 1 << iota // There are staged changes on the EBM that been pushed to Github EBMChangesStaged // There are unstaged changes on the EBM EBMChangesUnstaged // EBM is in merged state, and conflicts need to be resolved EBMConflicted // There are changes on Github that haven't propagated to EBM EBMBehind // Commits on EBM haven't been propagated to Github. This is perhaps a theoretical // consideration, since design suggests no commits happen on EBM that aren't at // once pushed. EBMAhead // EBMUnimplemented is a Git state that EBM cannot handle. This will need to be // looked at if we encounter any of these. EBMUnimplemented // The GitHub repo is the source, and has no parent ParentNotExist // The parent of the GitHub repo is ahead of the GitHub repo ParentAhead // The parent of the GitHub repo is behind the GitHub repo: need to issue a PR ParentBehind // The parent of the GitHub repo, and the GitHub repo are in sync. // ParentInSync = (0==(state & (ParentAhead|ParentBehind|ParentNotExist))) ParentInSync StateNotSet )
const DefaultSearchFile = `_data/meta.yml`
const GithubTokenCookie = "github_token_cookie"
Variables ¶
var ErrNoGitDirectory = errors.New(`Not a GIT directory`)
var ErrNoGithubParent = errors.New(`This repo has no github parent: it was not forked.`)
var ErrNotInConflictedState = errors.New(`This repo is not in a conflicted state.`)
var ErrNotLoggedIn = errors.New(`No github token cookie found`)
var ErrRemoteIsNotGithub = fmt.Errorf("Remote is not a github remote")
var ErrUnknownUser = errors.New(`UnknownUser: no recognized login or ID`)
ErrUnknownUser indicates that Github was unable to resolve the user's name.
Functions ¶
func Checkout ¶
Checkout checks out the github repo into the cached directory system, and returns the path to the root of the repo. If the client is already checked out, it updates from the origin server. Returns the directory and a possible error.
func ContributeToRepo ¶
func ContributeToRepo(client *Client, repoUserAndName string, private bool, msgCallback func(msg string)) error
ContributeToRepo configures a fork of the repo for the given user, and checks out the newly forked repo.
func CreateFile ¶
func DeleteFile ¶
func DeltaToString ¶
func DiffDeltaPath ¶
DiffDeltaPath returns the path from a DiffDelta, selecting the OldFile by preference, or the NewFile if the OldFile is not defined
func DiffFlagToString ¶
DiffFlagToString returns a string representation of a git2go.DiffFlag
func DiskSpaceFree ¶
func DuplicateRepo ¶
func DuplicateRepo(client *Client, githubPassword string, templateRepo string, orgName string, newRepo string, private bool) error
DuplicateRepo duplicates the template repo into the user's github repos, and gives it the name newRepo. This is used to start a new book, without being a fork of the EBW electric-book repo. See https://help.github.com/articles/duplicating-a-repository/ for more information.
func FetchRemote ¶
FetchRemote fetches all branches of the remote. It is the caller's responsibility to .Free the returned *Remote.
func FetchRemoteForRepo ¶
func FetchRemoteForRepoDir ¶
func FileExistsInWorkingDir ¶
func FileRenameInWorkingDir ¶
func FreeCommitSlice ¶
FreeCommitSlice frees each of the git2go.Commit pointers in the given slice.
func GetFileSHA ¶
func GetPullRequest ¶
func GetUserForDir ¶
GetUserForDir returns the user and token for the git repo containing the given directory. If an empty string is supplied as the directory, the current working directory is used instead.
func GitCloneTo ¶
GitCloneTo clones a repo to the given working directory.
func GitCurrentBranch ¶
GitCurrentBranch returns the name of the currently checked-out branch.
func GitFindRepoRootDirectory ¶
GitFindRepoRootDirectory returns the first parent directory containing a .git subfolder, or an error if no such directory is found.
func GitMergeAnalysisToString ¶
func GitMergeAnalysisToString(a git2go.MergeAnalysis) string
func GitMergePreferenceToString ¶
func GitMergePreferenceToString(a git2go.MergePreference) string
func GitNotExistError ¶
GitNotExistError returns true if the given error occurred because the specified path did not exist
func GitRemoteRepo ¶
GitRemoteRepo returns the remote repo name of the given remote It expects a remote of the form: [remotename] [remoteURL] ([fetch|push)]) so parses the results of `git remote get-url [remote]` which is expected to be a URL, takes the path and strips .git
func GitRepositoryStateToString ¶
func GitRepositoryStateToString(state git2go.RepositoryState) string
func GitStatusToString ¶
func GithubDeleteRepo ¶
GithubDeleteRepo deletes a repository on the github systems. See https://developer.github.com/v3/repos/#delete-a-repository Note that this should be used with extreme caution, since this is a total delete of the repo and all it contains, and cannot be undone.
func GithubPaginate ¶
GithubPaginate handles pagination across Github calls that require a ListOptions class to determine the pagination.
func GithubTokenFromWebRequest ¶
GithubTokenFromWebRequest returns the github token set with the token.
func ListFiles ¶
ListFiles returns an array of all the files in the repo that match the pathRegexp regular expression.
func ListPullRequests ¶
func ListPullRequests(client *Client, repoOwner, repoName string) ([]*github.PullRequest, error)
ListPullRequests returns a list of the Pull Requests for the given repoOwner/repoName
func PullRequestClose ¶
func PullRequestDir ¶
PullRequestDir returns the local git_cache location for the given pull request, or if sha is an empty string, the root directory for all prrequest checkouts
func PullRequestRemoteName ¶
func PullRequestRemoteName(pr *github.PullRequest) string
PullRequestRemoteName returns the remote name for this PR when we configure it in our repo
func PullRequestUpdate ¶
func PullRequestUpdate(client *Client, user, repoOwner, repoName string, sha string, path string, content []byte) error
PullRequestUpdate just updates the file in the 'master' repo the same as editing in the regular system.
func PullRequestVersions ¶
func PullRequestVersions(client *Client, user, repoOwner, repoName, remoteUrl, remoteSha, filePath string) (string, string, error)
PullRequestVersions returns the local and remote version of the file named in filePath. This is used to match files for pull-request file merging.
func RemoteName ¶
RemoteName returns a name for the remote based on the remoteUrl
func RepoDir ¶
RepoDir returns the local git_cache repo working directory location. If repoOwner or repoName is an empty string, the path is returned up to that level. BUT, you cannot just Join the path pieces - you need to call RepoDir again to get the additional parts.
func SaveWorkingFile ¶
SaveWorkingFile saves the named file on the repo in the working directory. It does not commit the file's change.
func StageFile ¶
StageFile adds the named file to the index, or removes the file from the index if it does not exist in the working dir. This is intended as a functional equivalent of `git add [path]`
func UpdateFile ¶
UpdateFile updates the given file with the given content, and adds it to the git staging area, ready for the next commit.
func UrlUserRepo ¶
UrlUserRepo returns the user and repo given a github URL
Types ¶
type Client ¶
type Client struct { *github.Client Username string Token string Context context.Context User *github.User }
func ClientFromCLIConfig ¶
ClientFromConfig returns the client based on the configuration
func ClientFromCLIConfigAlias ¶
ClientFromCLIConfigAlias returns the client for the user with the given alias from the cli config.
func ClientFromCLIConfigNamed ¶
ClientFromCLIConfigNamed returns the client for the named user from the cli config.
func ClientFromUsernamePassword ¶
ClientFromUsernamePassword returns a new GitHub client from the given username-password combination, or from CLI config if both are empty strings.
func ClientFromWebRequest ¶
ClientFromWebRequest returns a client for Github communcations from the given web request.
func (*Client) AddAuth ¶
AddAuth adds username and password authentication to the origUrl from the client credentials.
func (*Client) GithubInvitationAccept ¶
GithubInvitationAccept accepts or declines the invitation with the given ID.
func (*Client) UserInvitations ¶
func (c *Client) UserInvitations() ([]*GithubInvitation, error)
UserInvitations returns a slice of all the open invitations for the current user.
type CommitInfo ¶
type CommitInfo struct { LastModified time.Time Committer string // contains filtered or unexported fields }
func LastCommit ¶
func LastCommit(client *Client, userName, repoName string) (*CommitInfo, error)
LastCommit returns the last commit for the given repo
type ConflictWalkFunc ¶
type ConflictWalkFunc func(git2go.IndexConflict) error
ConflictWalkFunc is the callback function to use with WalkConflicts
type DiffDelta ¶
type DiffDelta struct { Type DiffDeltaType git2go.DiffDelta }
DiffDelta is a wrapper around git2go.DiffDelta
func (*DiffDelta) StatusString ¶
type DiffDeltaType ¶
type DiffDeltaType int
const ( HeadToIndex DiffDeltaType = 1 << iota IndexToWt )
type Directory ¶
type Directory struct { Files []DirectoryEntry // contains filtered or unexported fields }
func (*Directory) Filter ¶
func (d *Directory) Filter(base string, filter func(fullname string) bool) DirectoryEntry
func (*Directory) IsDirectory ¶
func (*Directory) MarshalJSON ¶
func (*Directory) ReadDirectory ¶
type DirectoryEntry ¶
type DirectoryEntry interface { Name() string IsDirectory() bool Map() map[string]interface{} Filter(base string, f func(fullname string) bool) DirectoryEntry }
func ListAllRepoFiles ¶
func ListAllRepoFiles(client *Client, user, repoOwner, repoName string) (DirectoryEntry, error)
ListAllRepoFiles returns a Directory type with all the files in the repo.
func NewDirectory ¶
func NewDirectory(base string) (DirectoryEntry, error)
type EBWRepoStatus ¶
type EBWRepoStatus struct { MergingDescription string `yaml:"merging_description"` MergingPRNumber int `yaml:"merging_pr_number"` // MergingFiles is a list of the files that are in conflict / modified // when the merge occurs. Because EBW allows us to delete and commit a delete // on the server, the deleted file will not exist in either the repo, the // their files, or the index, so it's not possible for us to find out that the // file has been deleted and committed (although the file should still exist in // HEAD, we would have to work our way through the whole of HEAD looking for it). MergingFiles []string `yaml:"merging_files"` // LastPRHash contains the Hash of the commit used for the last PR // sent from this repo. This is used to determine whether new changes // have been made on the repo that the user could push upstream. LastPRHash string `yaml:"last_pr_hash"` // LastUpstreamMergeHash is the last hash on the upstream remote // with which the local has merged. We need this to determine two // things- whether we have new PR's to push - LastUpstreamMergeHash string `yaml:"last_upstream_merge_hash"` // contains filtered or unexported fields }
EBWRepoStatus constains information on the status of the repo that might not (?) be possible to retrieve from reading the actual repo directory. In particular, it describes, when a merge is in process, which (if any) PR is being merged, and the origin of the merge (e.g. merging a particular PR, or merging with Github, or merging with original book).
func (*EBWRepoStatus) Read ¶
func (rs *EBWRepoStatus) Read(path string) (*EBWRepoStatus, error)
Read reads the EBWRepoStatus from the path provided
func (*EBWRepoStatus) ResetMerge ¶
func (rs *EBWRepoStatus) ResetMerge()
ResetMerge resets all the merge information in the EBWRepoStatus struct
func (*EBWRepoStatus) ToYaml ¶
func (rs *EBWRepoStatus) ToYaml() string
ToYaml converts the EBWRepoStatus to a yaml description
func (*EBWRepoStatus) Write ¶
func (rs *EBWRepoStatus) Write() error
Write writes the EBWRepoStatus back to the file whence it was read.
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) Filter ¶
func (f *File) Filter(base string, filter func(fullname string) bool) DirectoryEntry
func (*File) IsDirectory ¶
func (*File) MarshalJSON ¶
type FileDiff ¶
FileDiff contains a difference between two versions of a single file
func (*FileDiff) NewFileExists ¶
func (*FileDiff) NewFileOidString ¶
func (*FileDiff) OldFileExists ¶
func (*FileDiff) OldFileOidString ¶
type FileInfo ¶
func NewFileInfoFromPath ¶
type FileTree ¶
FileTree is a model of a filetree that is stored on disk. The Path() method resolves relative paths into the tree, while the Temporary flag indicates whether the filetree will be removed on cleanup.
func (*FileTree) Exists ¶
Exists returns true if the given path exists on the FileTree or false otherwise.
type FileVersion ¶
type FileVersion int
type Git ¶
type Git struct { Context context.Context Repository *git2go.Repository Log logger.Logger // contains filtered or unexported fields }
Git struct provides the commands that the command-line git repo would provide, with, perhaps, some slight additionals. Largely, it works off the git2go library, and manages a few presumed things about the library, but scanning for github username-password, etc. It also manages the EBWRepoStatus, which is an extended-status form for a Git repo.
func OpenGit ¶
OpenGit opens a Git Repo at the given directory, and configures the logger for the git repo
func (*Git) AddAllStagedFilesToIndex ¶
Adds all staged working dir files to the index.
func (*Git) AddAuth ¶
AddAuth adds username and password authentication to the original url taken from the repo origin client credentials.
func (*Git) AddRemote ¶
AddRemote adds the named remote to Git with the given clone URL. If the remote already exists, AddRemote does not change it.
func (*Git) AddToIndex ¶
AddToIndex adds the file at path to the index, if it exists, or deletes the file in the index if it does not exist.
func (*Git) AheadBehind ¶
AheadBehind returns the commits that HEAD is ahead, and that HEAD is behind remote.
func (*Git) CatFileVersion ¶
CatFileVersion returns the contents of the path for the given GitFileVersion
func (*Git) Commit ¶
Commit commits the staged changes on the repo with the given message. Commit also cleans up any meta-state that exists as a result of committing a merge- it closes PR's and updates the EBW status.
func (*Git) CommitFileDiffs ¶
CommitFileDiffs returns a slice of FileDiffs for all differences between the two commits. oldObject and newObject need to be objects that can resolve to Trees / Commits. If null==oldObject, oldObject will be set to the current repo HEAD.
func (*Git) ConflictFileDiffs ¶
ConflictFileDiffs sets all file differences between the two supplied commits to a conflict state. If nil==oldCommitObject, oldCommitObject will be set to the current repo's HEAD
func (*Git) DefaultSignature ¶
DefaultSignature guesses at a signature for the repo based on the git username and config
func (*Git) ExistsFileVersion ¶
ExistsFileVersion returns whether the path exists for the given GitFileVersion
func (*Git) FetchRefspecs ¶
FetchRefspecs fetches the refspecs for the named remote.
func (*Git) FetchRemote ¶
FetchRemote fetches the named remote into our repo.
func (*Git) GetBranch ¶
GetBranch looks up the branch with the given name, where the name could be HEAD, a branch name, or a remote/branch name format.
func (*Git) GetUpstreamRemote ¶
GetUpstreamRemote returns the owner and repo-name for the repo's upstream remote.
func (*Git) GetUpstreamRemoteActions ¶
func (g *Git) GetUpstreamRemoteActions() (GitRemoteAction, error)
GetUpstreamRemoteActions indicates the possible actions we could perform on upstream repo.
func (*Git) GithubClient ¶
GitubClient returns a github.Client configured with the password for the `origin` remote of this git repo. It ONLY uses the password, hence it requires the password to be a github TOKEN. If the password is not a token, the github client it returns will not work.
func (*Git) GithubClosePullRequest ¶
GithubClosePullRequest closes the currently open pull-request on github.
func (*Git) GithubRemote ¶
func (g *Git) GithubRemote(remoteName string) (*GithubRemote, error)
GithubCanSubmitPR returns true if this repo has a github parent - an upstream repo - and the current repo differs from the upstream remote at the last point that the upstream remote was merged.
func (*Git) GithubRepo ¶
func (g *Git) GithubRepo() (*github.Repository, error)
GithubRepo returns github.Repository for the github repo that this repo was cloned from.
func (*Git) GithubUser ¶
GithubUser returns the github user for this repo
func (*Git) HasConflicts ¶
HasConflicts returns true if the repo has conflicted files
func (*Git) HasUpstreamRemote ¶
HasUpstreamRemote returns true if the repo has an upstream remote - ie a parent to the github repo
func (*Git) IsFileConflicted ¶
IsFileConflicted returns true if the file at the given path is in a conflicted state.
func (*Git) ListConflictedFiles ¶
ListConflictedFiles returns a list of the files that are conflicted in the repo.
func (*Git) ListDiffsIndexToWt ¶
ListDiffsIndexToWt returns the RepoDiffs for the difference between the index and the working tree.
func (*Git) MergeAnalysis ¶
func (g *Git) MergeAnalysis(remoteName string) (git2go.MergeAnalysis, git2go.MergePreference, error)
MergeAnalysis returns the git2go analysis of possible merge options with the given remote.
func (*Git) MergeBranch ¶
func (g *Git) MergeBranch(remoteName string, resolve MergeResolution) (bool, error)
MergeBranch merges the remote branch with the given resolution. The return values are TRUE if a fast-forward was possible, false if no fast-forward was effected.
func (*Git) MergeCanFastForward ¶
MergeCanFastForward returns true if it is possible for this merge to fast-foward to the given remote.
func (*Git) MergePullRequest ¶
MergePullRequest does a merge with the given PullRequest identified by number and pullRequestSHA
func (*Git) MergingFilesList ¶
func (g *Git) MergingFilesList() ([]*IndexFileStatusAbbreviated, error)
MergingFilesList returns a list of the files that are currently in the process of being merged to resolve the current conflict state
func (*Git) MergingPRNumber ¶
MergingPRNumber returns the number of the PR currently being merged, or 0 if no PR is currently being merged.
func (*Git) PathEBWConfig ¶
PathEBWConfig returns the path to the ebw config directory
func (*Git) PathTheir ¶
PathTheir returns the path to the cached checkout of 'their' when a merge is in progress.
func (*Git) PrintEBWRepoStatus ¶
PrintEBWRepoStatus prints the info from the EBWRepoStatus to the io.Writer
func (*Git) PullAbort ¶
PullAbort aborts a merge that is in progress. This isn't quite like `git merge --abort`, because this is in fact simply a RESET to HEAD, which occurs in spite of, or while ignoring, any changed files in WD. `git merge --abort`, though, will fail if there are modified files in WD (or something like that).
func (*Git) PullOrigin ¶
PullOrigin pulls the repo origin and attempts an auto-merge with master branch. If the merge succeeds, a new commit is generated.
func (*Git) PullUpstream ¶
PullUpstream pulls the repo upstream and attempts to auto-merge with the master branch. If the merge succeeds without conflict, a new commit is generated.
func (*Git) RemoteUser ¶
RemoteUser returns the username and password of the remote git user.
func (*Git) RemoveConflict ¶
RemoveConflict resolves the conflict on the file at the given path with the file in the WD, or deletes if the file does not exist in the WD
func (*Git) RepoState ¶
func (g *Git) RepoState() *GitRepoState
RepoState returns the state of the repo. Per https://libgit2.github.com/libgit2/#HEAD/group/repository/git_repository_state this determines the status of a git repository - ie, whether an operation (merge, cherry-pick, etc) is in progress.
func (*Git) SHARemote ¶
SHARemote returns the SHA of the TREE of the HEAD of the remote repo as a string. If fetch is true, it will fetch the remote first.
func (*Git) SetRemoteUserPassword ¶
SetRemoteUserPassword sets the username and password for the given remote. It sets the fetch URL, and the pushurl if there is one configured.
func (*Git) SetUpstreamRemote ¶
SetUpstreamRemote sets the remote `upstream` for the repo.
func (*Git) SetUsernameEmail ¶
SetUsernameEmail sets the git user.name and user.email configuration values.
func (*Git) StagedFiles ¶
func (g *Git) StagedFiles() ([]*IndexFileStatus, error)
StagedFiles returns a list of the files currently staged in the index.
func (*Git) UpdateRemoteGithubIdentity ¶
UpdateRemoteGithubIdentity updates all github remotes for the git repo inserting the given username and password for each URL.
func (*Git) WalkConflicts ¶
func (g *Git) WalkConflicts(f ConflictWalkFunc) error
WalkConflicts calls the ConflictWalkFunc for every conflict in the index.
func (*Git) WriteVersionToWd ¶
func (g *Git) WriteVersionToWd(path string, v GitFileVersion) error
WriteVersionToWd writes the given version of the file to the wd.
type GitFileVersion ¶
type GitFileVersion int
func ParseGitFileVersion ¶
func ParseGitFileVersion(in string) (GitFileVersion, error)
ParseGitFileVersion converts a string to a GitFileVersion
type GitRemoteAction ¶
type GitRemoteAction int
const ( GitRemoteActionNone GitRemoteAction = 0 GitRemoteActionCreatePR GitRemoteAction = 1 GitRemoteActionPull = 2 )
func (GitRemoteAction) CanCreatePR ¶
func (ra GitRemoteAction) CanCreatePR() bool
func (GitRemoteAction) CanPull ¶
func (ra GitRemoteAction) CanPull() bool
func (GitRemoteAction) InSync ¶
func (ra GitRemoteAction) InSync() bool
func (GitRemoteAction) String ¶
func (ra GitRemoteAction) String() string
type GitRepo ¶
type GitRepo struct { *github.Repository // contains filtered or unexported fields }
func FetchRepos ¶
FetchRepos fetches all the repositories for the client
func (*GitRepo) CanPush ¶
CanPush returns true if this user can push to the repo, or false otherwise
func (*GitRepo) GetLastCommit ¶
func (gr *GitRepo) GetLastCommit() *CommitInfo
func (*GitRepo) GetTotalPRs ¶
func (*GitRepo) RepoOwnerNiceName ¶
RepoOwnerNiceName returns the users name or login if the name isn't available.
type GitRepoState ¶
type GitRepoState struct {
RepositoryState git2go.RepositoryState
}
GitRepoState wraps the state of a repo.
func (*GitRepoState) String ¶
func (rs *GitRepoState) String() string
type GithubInvitation ¶
type GithubInvitation struct {
*github.RepositoryInvitation
}
type GithubRemote ¶
type IndexFileStatus ¶
type IndexFileStatus struct {
*git2go.StatusEntry
}
func NewIndexFileStatus ¶
func NewIndexFileStatus(se git2go.StatusEntry) *IndexFileStatus
func (*IndexFileStatus) Abbreviated ¶
func (ifs *IndexFileStatus) Abbreviated() *IndexFileStatusAbbreviated
func (*IndexFileStatus) Path ¶
func (ifs *IndexFileStatus) Path() string
func (*IndexFileStatus) StatusString ¶
func (ifs *IndexFileStatus) StatusString() string
type MergeFileInfo ¶
func (*MergeFileInfo) String ¶
func (mf *MergeFileInfo) String() string
type MergeFileResolutionState ¶
type MergeFileResolutionState int
func (*MergeFileResolutionState) MarshalJSON ¶
func (m *MergeFileResolutionState) MarshalJSON() ([]byte, error)
func (MergeFileResolutionState) String ¶
func (m MergeFileResolutionState) String() string
type MergeResolution ¶
type MergeResolution int
const ( // ResolveAutomatically will attempt to auto-merge // all files. If a file can be auto-merged, it will be added to the // index and wd in a resolved state, and marked as resolved in the index. // If the file cannot be automatically resolved, it will be marked as // conflicted in the index, and the WD will contain the git-merge // result. ResolveAutomatically MergeResolution = 1 // ResolveConficted will leave all files in the merge in a // conflicted state, even in the situation where Git might have been // able to resolve the merge. ResolveConflicted = 2 )
type PullRequest ¶
type PullRequest struct {
*github.PullRequest
}
type PullRequestDiff ¶
type PullRequestDiff struct { Path string `json:"path"` RemotePath string `json:"remote_path"` RemoteHash string `json:"remote_hash"` LocalPath string `json:"local_path"` LocalHash string `json:"local_hash"` Equal bool `json:"equal"` }
func GetPathDiff ¶
func GetPathDiff(localRoot, remoteRoot, path string) (*PullRequestDiff, error)
func GetPathDiffList ¶
func GetPathDiffList(localPath, remotePath string, pathRegexp string) ([]*PullRequestDiff, error)
func PullRequestDiffList ¶
func PullRequestDiffList(client *Client, repoOwner, repoName string, pr *github.PullRequest) ([]*PullRequestDiff, error)
func PullRequestDiffListByNumber ¶
func PullRequestDiffListByNumber(client *Client, repoOwner, repoName string, prNumber int) ([]*PullRequestDiff, error)
func (*PullRequestDiff) String ¶
func (prd *PullRequestDiff) String() string
type PullRequestInfo ¶
type PullRequestInfo struct { PRCount int // contains filtered or unexported fields }
type Repo ¶
type Repo struct { *git2go.Repository Dir string Client *Client RepoOwner string RepoName string EBWRepoStatus *EBWRepoStatus Log *logrus.Entry Git *Git // contains filtered or unexported fields }
Repo is a struct mapped to a directory on dist with a checked-out github repo. The directory does not necessarily have to be configured against the server git_cache, but could be retrieved with NewRepoForDir(..), which allows creating the repo against an existing directory possibly in a different location.
func NewRepo ¶
NewRepo returns a new Repo struct configured against the directory with the checked-out repo.
func NewRepoForDir ¶
NewRepoForDir returns a new repo configured for the given directory.
func (*Repo) AddAllStagedFilesToIndex ¶
AddAllToIndex adds all staged files to the index, including deleting files from the index if they don't exist in the WD.
func (*Repo) AddRemote ¶
AddRemote adds the given remoteName with the given CloneURL, but does not change any existing remote with the given remoteName
func (*Repo) AddToIndex ¶
AddToIndex adds the file at path to the index, if it exists, or deletes the file in the index if it does not exist.
func (*Repo) AutoProcessState ¶
AutoProcessState runs automatic state processing on a repo, and returns true if the repo state has changed
func (*Repo) BranchCreate ¶
BranchCreate creates the named branch on the repo. The force param is set to true if you wish to overwrite an existing branch with the same name. If no name is provided, this function will assign a name based on the template PR_{{username}}_{{prN}} for the current head, where prN is the N+1 for N the total number of pull requests on the repo.
func (*Repo) CLI ¶
CLI returns true if this repo is working against a CLI, false if we're in a server situation.
func (*Repo) CanCreatePR ¶
CanCreatePR returns true if the Upstream repo is behind the Github repo, and there has been a new commit since the last PR was issued.
func (*Repo) Cleanup ¶
Cleanup cleans up the state of the repo, and also removes any temporary files that a merge or conflict state might have created. This is probably only necessary to call from CloseConflict - any other version should not be required.
func (*Repo) CleanupConflictTemporaryFiles ¶
CleanupConflictTemporaryFiles cleans up any temporary files used in a conflict resolution.
func (*Repo) CloseConflict ¶
CloseConflict closes the conflict on the repo, including closing PR's if PR merges are in process.
func (*Repo) CommitAll ¶
CommitAll works like `git commit -am` first adding all working-dir modified files to the index.
func (*Repo) CommitIfNoConflicts ¶
CommitIfNoConflicts will commit the changes to the repo if there are no conflicted files in the repo. Returns true if the commit succeeded, false otherwise.
func (*Repo) ConfigPath ¶
ConfigPath returns the path mapped into the EBW `config` directory
func (*Repo) DiffsIndexToWt ¶
DiffsIndexToWt returns the RepoDiffs for the difference between the index and the working tree.
func (*Repo) FetchRemote ¶
FetchRemote fetches the named remote for the repo.
func (*Repo) FileCat ¶
FileCat returns the contents of a conflicted or merged file. The first bool parameter indicates whether the files exists.
func (*Repo) FileGit ¶
FileGit returns the GIT version of a conflicted file. The first bool return indicates whether the file can be automerged.
func (*Repo) FileInfoFromIndex ¶
FileInfoFromIndex returns FileInfo for the given path from the Index
func (*Repo) GetRepoState ¶
GetRepoState returns the RepoState for the repo, cached if the repo state has been computed before.
func (*Repo) GetUpstreamPullRequestsCount ¶
GetUpstreamPullRequestsCount returns the number of PR's that the upstream github repo has.
func (*Repo) GithubRepo ¶
func (r *Repo) GithubRepo() (*github.Repository, error)
GithubRepo returns the github Repository for this repo.
func (*Repo) HasConflictedFiles ¶
HasConflictedFiles returns true if the repo has conflicted files, false if there are no conflicts in the repo.
func (*Repo) HasUpstreamRemote ¶
HasUpstreamRemote returns true if the repo has an upstream remote - ie a parent to the github repo
func (*Repo) IndexEntry ¶
func (r *Repo) IndexEntry(path string) (*git2go.IndexEntry, error)
IndexEntry returns the libgit2 entry from the Index for the given path.
func (*Repo) IsFileConflicted ¶
IsFileConflicted returns whether the given file is in conflict in the repo
func (*Repo) ListConflictedFiles ¶
ListConflictedFiles returns a list of all the currently conflicted files in the repo
func (*Repo) ListRepoConflicts ¶
func (r *Repo) ListRepoConflicts() ([]*RepoConflict, error)
ListRepoConflicts lists all the conflicted files in the repo. (The repo must be in a Merge state in order for there to be conflicted files at all.) It doesn't appear to be necessary that the repo is in a merge state in order to have conflicts - I've definitely managed to get conflicts in a repo that is in RepoStateNone. TODO: Investigate why it appears possible to be conflicted while in git2go.RepoStateNone
func (*Repo) MergeCommits ¶
MergeCommits returns a slice of the Commits that contributed to this merge. includeHead indicates whether to include the HEAD commit - this should always be TRUE. The caller needs to free the Commit structures. Use the handy FreeCommitSlice([]*Commit) to do so.
func (*Repo) MergeFileInfo ¶
func (r *Repo) MergeFileInfo(path string) (*MergeFileInfo, error)
MergeFileInfo returns the MergeFileInfo for the named path in the Working dir, the Their dir, and the Index
func (*Repo) MergeFileResolutionState ¶
func (r *Repo) MergeFileResolutionState(path string) (MergeFileResolutionState, error)
MergeFileResolutionState returns the state of the merging file at the given path.
func (*Repo) MergeWith ¶
func (r *Repo) MergeWith(remote, branch string, resolve ResolveMergeOption, conflicted bool, prNumber int, description string) error
MergeWith merges the repo with the given remote and branch, and configures all the EBW Server required configurations for correct conflict management. At present MergeWith will not work on the command line unless the user is within a EBW Server structured git repo.
func (*Repo) MergingFilesList ¶
func (r *Repo) MergingFilesList() ([]*IndexFileStatusAbbreviated, error)
MergingFilesList returns a slice of all the files in the repo that are merging, with a status indication for each.
func (*Repo) MergingPRNumber ¶
MergingPRNumber returns the number of the current PR being merged, or 0 if no PR is currently being merged.
func (*Repo) MustRepoState ¶
func (*Repo) PrintLocalChanges ¶
PrintLocalChanges prints all locally chnaged files that aren't staged.
func (*Repo) PrintStatusList ¶
PrintStatusList prints the information from the status list for the repo. It is primarily at this point intended as a debugging tool.
func (*Repo) Pull ¶
Pull fetches and merges this repo with the branchName of the remote repo. Note that Pull will leave the repo in the Merge state. You need to fix any conflicts, and then commit.
func (*Repo) PullAbort ¶
PullAbort aborts a merge that is in progress. This isn't quite like `git merge --abort`, because this is in fact simply a RESET to HEAD, which occurs in spite of, or while ignoring, any changed files in WD. `git merge --abort`, though, will fail if there are modified files in WD (or something like that).
func (*Repo) PullOrigin ¶
PullOrigin pulls the repos origin into the repo, merging per git merge rules.
func (*Repo) PullPR ¶
PullPR pulls the given PR into the repo, doing a our-their merge on conflicted files.
func (*Repo) PullRequest ¶
func (r *Repo) PullRequest(number int) (*github.PullRequest, error)
PullRequest returns the pull request with the given number for the repo.
func (*Repo) PullRequestClose ¶
PullRequestClose closes the given PR, with the merged indication and the given message.
func (*Repo) PullRequestCreate ¶
PullRequestCreate creates a new Pull Request from the user's repo to the upstream repo. In order to ensure that changes to the user's repo aren't propagated with the PR, we branch at the point of PR creation.
func (*Repo) PullRequestFetch ¶
func (r *Repo) PullRequestFetch(number int, pr *github.PullRequest) error
PullRequestFetch fetches the numbered pull request so that it can be merged with the current repo. The pr can be supplied in the second parameter, on the off-chance that you've already fetched it: no point making two GitHub API calls.
func (*Repo) PullRequestList ¶
func (r *Repo) PullRequestList() ([]*github.PullRequest, error)
PullRequestList returns a list of the PullRequests for this repo.
func (*Repo) PullRequestMerge ¶
PullRequestMerge merges the PR with the given number with the HEAD of the current repo.
func (*Repo) PullUpstream ¶
PullUpstream pulls the repos upstream into the repo, merging per git merge rules.
func (*Repo) Push ¶
Push implements 'git push remote branch' for the repo. TODO: Check whether my ref string is able to push not just from our master-to-master, but also from master -> x or x -> y
func (*Repo) PushOrigin ¶
PushOrigin is a shorthand to push the repo to origin/master.
func (*Repo) RepoOwnerAndName ¶
RepoOwnerAndName returns the repo owner and name for the repo.
func (*Repo) RepoPath ¶
Path returns the path to the filename INSIDE THE GIT REPO constructed from the concatenated elements passed to RepoPath. If you don't provide any elements, the repo dir is returned.
func (*Repo) RepoStateString ¶
func (*Repo) RepoStateStringNoError ¶
func (*Repo) ResetConflictedFilesInWorkingDir ¶
func (r *Repo) ResetConflictedFilesInWorkingDir(chooseOurs, conflictedOnly bool, filter func(r *Repo, path string, entry *git2go.StatusEntry) bool) error
ResetConflictedFilesInWorkingDir goes through conflicted files in the working directory and sets them to either our version or their version. The file remains in conflict.
func (*Repo) ResetState ¶
func (r *Repo) ResetState()
ResetState resets a repo's state so that the next call to GetRepoState will recompute the repo's state.
func (*Repo) RevertDiffDelta ¶
RevertDiffDelta reverts the DiffDelta on this repo.
func (*Repo) RevertLocalChanges ¶
RevertLocalChanges reverts all local changed files that aren't staged. Using EBM, we should never have local changes that aren't staged, so these files are generated by processes that run on the repo. We don't want to keep them, since they can cause issues with pulling new files.
func (*Repo) SearchForFiles ¶
SearchForFiles returns a list of all files that match the given regexp. It ignores all files that are ignored in Git, and skips all ignored directories.
func (*Repo) SetUpstreamRemote ¶
SetUpstreamRemote configures the `upstream` remote in the github repo. It discovers the upstream remote by looking for the repo's parent on Github.
func (*Repo) StagedFiles ¶
func (r *Repo) StagedFiles() ([]*IndexFileStatus, error)
StagedFiles returns the list of files staged but not committed in the repository.
func (*Repo) StagedFilesAbbreviated ¶
func (r *Repo) StagedFilesAbbreviated() ([]*IndexFileStatusAbbreviated, error)
StagedFilesAbbreviated returns an easily JSON encoded list of staged files with paths.
func (*Repo) StatusCount ¶
StatusCount returns the number of uncommitted items in the index-head and the workingdir-index for the repo.
func (*Repo) StatusList ¶
func (r *Repo) StatusList() (*git2go.StatusList, error)
StatusList returns the list of status entries for the repo. The caller needs to .Free() the returned object.
func (*Repo) StatusListFilenames ¶
StatusListFilenames returns a slice on only the filenames of the files appearing in the StatusList
func (*Repo) TheirPath ¶
TheirPath returns the path to the `their` version of a file used during Merge resolution.
func (*Repo) TheirTree ¶
TheirTree returns a FileTree instance into the merge-conflict temporary `their` tree
func (*Repo) UpdateFileBinary ¶
UpdateFileBinary writes the given file and updates it in git.
func (*Repo) WorkingTree ¶
WorkingTree returns a FileTree instance into the working directory for the repo.
type RepoConflict ¶
RepoConflict provides details on a conflicted file in the repo.
func (*RepoConflict) String ¶
func (rc *RepoConflict) String() string
type RepoDiffStats ¶
func CompareCommits ¶
type RepoState ¶
type RepoState int
RepoState describes the state of the repo with regard to it's GitHub origin repo, and the parent of that GitHub repo.
func (RepoState) LocalAhead ¶
func (RepoState) LocalBehind ¶
func (RepoState) LocalChanges ¶
func (RepoState) LocalChangesStaged ¶
func (RepoState) LocalChangesUnstaged ¶
func (RepoState) LocalConflicted ¶
func (RepoState) LocalInSync ¶
func (RepoState) LocalUnimplemented ¶
func (RepoState) ParentAhead ¶
func (RepoState) ParentBehind ¶
func (RepoState) ParentInSync ¶
func (RepoState) ParentNotExist ¶
type ResolveMergeOption ¶
type ResolveMergeOption int
const ( ResolveMergeOur ResolveMergeOption = 1 << iota ResolveMergeTheir ResolveMergeGit )
type StatusEntry ¶
type StatusEntry struct {
git2go.StatusEntry
}
func (*StatusEntry) Filename ¶
func (se *StatusEntry) Filename() string
Filename returns the name of the file based on the HEAD-Index status.
func (*StatusEntry) StatusType ¶
func (se *StatusEntry) StatusType() string
StatusType returns a textual type description of the HEAD-Index status of the entry
type StatusList ¶
type StatusList struct {
*git2go.StatusList
}
func GitStatusList ¶
func GitStatusList(ctxt context.Context, repoDir string) (*StatusList, error)
GitStatusList returns the status list for a particular repo. If the caller provides a Context, the StatusList will be freed when the Context is done. Otherhe caller MUST call .Free on the StatusList when done.
func (*StatusList) Statuses ¶
func (s *StatusList) Statuses() chan *StatusEntry
Source Files ¶
- CommitInfo.go
- DirectoryEntry.go
- DiskSpaceFree.go
- EBWRepoStatus.go
- FileInfo.go
- FileTree.go
- Git.go
- GitClient.go
- GitRepo.go
- GitRepoContent.go
- GitRepoDiff.go
- GitTools.go
- Git_Github.go
- Git_Merging.go
- Git_Merging_Diff.go
- Git_RepoState.go
- Git_Util.go
- GithubInvitation.go
- GithubPaging.go
- IndexFileStatus.go
- ListFiles.go
- MergeFileInfo.go
- MergeFileResolutionState.go
- Print.go
- PullRequest.go
- PullRequestDiff.go
- PullRequestInfo.go
- PullRequests.go
- Remotes.go
- Repo.go
- RepoConflict.go
- RepoOwner.go
- RepoState.go
- Repo_Diffs.go
- Repo_Logging.go
- Repo_PullRequests.go
- ResolveMergeOption.go
- Status.go
- gitCommands.go