Git.AheadBehindInfo, Git.AllowExitCode| Constructor and Description |
|---|
DefaultGitImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommit(Path pathWorkspace,
String message,
Map<String,String> mapCommitAttr,
boolean indPush)
Synchronizes the working copy with the index and commits.
|
void |
checkout(Path pathWorkspace,
org.azyva.dragom.model.Version version)
Git checkout.
|
void |
clone(String reposUrl,
org.azyva.dragom.model.Version version,
Path pathWorkspace)
Git clone.
|
void |
config(Path pathWorkspace,
String param,
String value)
Sets a configuration parameter within the Git workspace (local
repository).
|
String |
convertToRef(org.azyva.dragom.model.Version version)
Converts a
Version to a Git reference such as refs/tags/<tag> or
refs/remotes/origin/<branch>. |
void |
createBranch(Path pathModuleWorkspace,
String branch,
boolean indSwitch)
Creates a branch.
|
void |
createTag(Path pathModuleWorkspace,
String tag,
String message)
Creates a tag.
|
int |
executeGitCommand(String[] arrayArg,
boolean indProvideCredentials,
Git.AllowExitCode allowExitCode,
Path pathWorkingDirectory,
StringBuilder stringBuilderOutput)
Helper method to execute a Git command.
|
void |
fetch(Path pathWorkspace,
String reposUrl,
String refspec,
boolean indFetchingIntoCurrentBranch)
Git fetch.
|
Git.AheadBehindInfo |
getAheadBehindInfo(Path pathWorkspace)
Determines if the remote repository contains changes that are not in the
local repository (behind) and/or if the local repository contains changes
that are not in the remote repository (ahead).
|
String |
getBranch(Path pathWorkspace)
Returns the current branch or null if detached.
|
List<org.azyva.dragom.model.Version> |
getListVersionStatic(Path pathWorkspace)
Returns the List of all static Version's (tags).
|
org.azyva.dragom.model.Version |
getVersion(Path pathWorkspace)
Returns the current version.
|
boolean |
isLocalChanges(Path pathWorkspace)
Verifies there are local changes that are not pushed.
|
boolean |
isReposExists() |
boolean |
isVersionExists(Path pathWorkspace,
org.azyva.dragom.model.Version version)
Tests if a Version exists.
|
boolean |
mergeSimple(Path pathWorkspace)
Merges the current branch's remote counterpart into the current branch.
|
boolean |
pull(Path pathWorkspace)
Git pull.
|
void |
push(Path pathWorkspace)
Pushes all refs, branches and tags.
|
void |
push(Path pathWorkspace,
String gitRef)
Git push.
|
boolean |
rebaseSimple(Path pathWorkspace)
Rebases the current branch on its remote counterpart.
|
void |
setPassword(String password)
Sets the password to access Git repositories.
|
void |
setPathExecutable(Path pathExecutable)
Sets the Path to the git executable.
|
void |
setReposUrl(String reposUrl)
Sets the repository URL.
|
void |
setUser(String user)
Sets the user to access Git repositories.
|
boolean |
validateCredentials() |
public void setPathExecutable(Path pathExecutable)
GitsetPathExecutable in interface GitpathExecutable - See description.public void setReposUrl(String reposUrl)
GitsetReposUrl in interface GitreposUrl - See description.public void setUser(String user)
GitIf not null and the repository URL contains a user (i.e.: https://jsmith@acme.com/my-repos.git), the user specified must be the same.
public void setPassword(String password)
GitGit.setUser(java.lang.String)) is null.setPassword in interface Gitpassword - See description.public int executeGitCommand(String[] arrayArg, boolean indProvideCredentials, Git.AllowExitCode allowExitCode, Path pathWorkingDirectory, StringBuilder stringBuilderOutput)
GitMostly used internally, but can be used by callers in order to submit a Git command that is not directly supported by this class.
executeGitCommand in interface GitarrayArg - Command line arguments to Git.indProvideCredentials - Indicates to provide the user credentials to
Git, if available.allowExitCode - Specifies which exit codes are allowed and will not
trigger an exception.pathWorkingDirectory - Path to the working directory. The command will be
executed with this current working directory. If null current working directy
is used.stringBuilderOutput - If not null, any output (stdout) of the command will
be copied in this StringBuilder.public boolean validateCredentials()
validateCredentials in interface Gitpublic boolean isReposExists()
isReposExists in interface Gitpublic String getBranch(Path pathWorkspace)
GitCan be used to check if the current Version is branch by comparing to null.
public void config(Path pathWorkspace, String param, String value)
Gitpublic void clone(String reposUrl, org.azyva.dragom.model.Version version, Path pathWorkspace)
Gitclone in interface GitreposUrl - Repository URL. Can be null in which case the repository URL
specified with Git.setReposUrl(java.lang.String) is used. Specifying the repository URL
allows the caller to clone from a local repository. When reposUrl is
specified it must use the file:// protocol.version - Version to checkout after clone. If null, no version is
checked out, not even master.pathWorkspace - Path to the workspace.public void fetch(Path pathWorkspace, String reposUrl, String refspec, boolean indFetchingIntoCurrentBranch)
Gitfetch in interface GitpathWorkspace - Path.reposUrl - Repository URL. Can be null in which case fetch occurs from
the remote named "origin" within the configuration of the workspace, and thus
implicitly from the remote repository specified with Git.setReposUrl(java.lang.String).
Can be a repository URL in which case refspec should be specified otherwise
Git will not know which refs to update. This allows the caller to fetch
between local repositories. When reposUrl is specified, it must use the
file:// protocol.refspec - The Git refspec to pass to git fetch. See the documentation for
git fetch for more information. Can be null if no refspec is to be passed to
git, letting git essentially use the default
refs/heads/*:refs/remotes/origin/heads/* refspec.indFetchingIntoCurrentBranch - This is to handle the special case where
the caller knows what is fetched into is the current branch, meaning that
refspec is specifed and ends with ":refs/heads/...". In such a case this
method specifies the --update-head-ok option to "git fetch" (otherwise git
complains that fetching into the current local branch is not allowed).public boolean rebaseSimple(Path pathWorkspace)
GitrebaseSimple in interface GitpathWorkspace - Path to the workspace.public boolean mergeSimple(Path pathWorkspace)
GitmergeSimple in interface GitpathWorkspace - Path to the workspace.public void push(Path pathWorkspace, String gitRef)
GitIf gitRef is not null --set-upstream used. This is to allow to always set the upstream tracking information because the push can be delayed and new branches can be pushed on the call to this method other than the one immediately after creating the branch.
In the case gitRef is a tag, --set-upstream has no effect.
public void checkout(Path pathWorkspace, org.azyva.dragom.model.Version version)
Gitpublic boolean isVersionExists(Path pathWorkspace, org.azyva.dragom.model.Version version)
GitisVersionExists in interface GitpathWorkspace - Path to the workspace.version - Version.public Git.AheadBehindInfo getAheadBehindInfo(Path pathWorkspace)
GitgetAheadBehindInfo in interface GitpathWorkspace - Path to the workspace.public boolean isLocalChanges(Path pathWorkspace)
GitisLocalChanges in interface GitpathWorkspace - Path to the workspace.public void push(Path pathWorkspace)
Gitpublic org.azyva.dragom.model.Version getVersion(Path pathWorkspace)
GitIf not on a branch, returns the tag corresponding to the current commit, if any.
getVersion in interface GitpathWorkspace - Path to the workspace.public List<org.azyva.dragom.model.Version> getListVersionStatic(Path pathWorkspace)
GitgetListVersionStatic in interface GitpathWorkspace - Path to the workspace.public void createBranch(Path pathModuleWorkspace, String branch, boolean indSwitch)
GitcreateBranch in interface GitpathModuleWorkspace - Path to the workspace.branch - Branch.indSwitch - Indicates whether we must switch (checkout) to the new
branch.public void createTag(Path pathModuleWorkspace, String tag, String message)
Gitpublic void addCommit(Path pathWorkspace, String message, Map<String,String> mapCommitAttr, boolean indPush)
Gitpublic String convertToRef(org.azyva.dragom.model.Version version)
GitVersion to a Git reference such as refs/tags/<tag> or
refs/remotes/origin/<branch>.
In the case of a dynamic Version, the remote branch is used.
convertToRef in interface Gitversion - Version.Copyright © 2015–2016 AZYVA INC.. All rights reserved.