public class GitUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_RELEASE_BRANCH
The Constant DEVELOP_BRANCH.
|
static String |
MASTER_BRANCH
The Constant MASTER_BRANCH.
|
| Constructor and Description |
|---|
GitUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkoutRepoBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
CommandResult commandResult)
Checkout repo branch.
|
static org.eclipse.jgit.api.Git |
cloneRepo(String sClonePath,
String sRepoURL,
CommandResult commandResult,
String strGitHubUserLogin,
String strUserName,
String strPassword)
Clone repo.
|
static void |
createLocalBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
CommandResult commandResult)
Creates the local branch.
|
static List<String> |
getBranchList(String repoUrl,
File localRepo,
CommandResult commandResult,
String login,
String pwd) |
static String |
getFileContent(String strFullName,
String strPathFile,
String strBranch,
String strUserName,
String strPassword)
Gets the file content.
|
static org.eclipse.jgit.api.Git |
getGit(String strClonePath)
Gets the git.
|
static String |
getLastCommitId(org.eclipse.jgit.api.Git git)
Gets the last commit id.
|
static String |
getLastLog(org.eclipse.jgit.api.Git git,
int nMaxCommit)
Gets the last log.
|
static String |
getRefBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
CommandResult commandResult)
Gets the ref branch.
|
static String |
getRepoUrl(String strRepoUrl)
Gets the repo url.
|
static List<String> |
getTagNameList(org.eclipse.jgit.api.Git git)
Gets the tag name list.
|
static org.eclipse.jgit.api.MergeResult |
mergeBack(org.eclipse.jgit.api.Git git,
String strUserName,
String strPassword,
CommandResult commandResult)
Merge back.
|
static org.eclipse.jgit.api.MergeResult |
mergeRepoBranch(org.eclipse.jgit.api.Git git,
String strBranchToMerge)
Merge repo branch.
|
static org.eclipse.jgit.api.PullResult |
pullRepoBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
String strUserName,
String strPassword)
Pull repo branch.
|
static void |
pushForce(org.eclipse.jgit.api.Git git,
String strRefSpec,
String strUserName,
String strPassword)
Push force.
|
static GithubSearchResult |
searchRepo(String strSearch,
String strOrganization,
String strUserName,
String strPassword)
Search repo.
|
public static final String MASTER_BRANCH
public static final String DEFAULT_RELEASE_BRANCH
public static org.eclipse.jgit.api.Git cloneRepo(String sClonePath, String sRepoURL, CommandResult commandResult, String strGitHubUserLogin, String strUserName, String strPassword)
sClonePath - the s clone pathsRepoURL - the s repo URLcommandResult - the command resultstrGitHubUserLogin - the str git hub user loginstrUserName - the str user namestrPassword - the str passwordpublic static void checkoutRepoBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
CommandResult commandResult)
git - the gitsBranchName - the s branch namecommandResult - the command resultpublic static void createLocalBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
CommandResult commandResult)
git - the gitsBranchName - the s branch namecommandResult - the command resultpublic static String getRefBranch(org.eclipse.jgit.api.Git git, String sBranchName, CommandResult commandResult)
git - the gitsBranchName - the s branch namecommandResult - the command resultpublic static void pushForce(org.eclipse.jgit.api.Git git,
String strRefSpec,
String strUserName,
String strPassword)
throws org.eclipse.jgit.api.errors.InvalidRemoteException,
org.eclipse.jgit.api.errors.TransportException,
org.eclipse.jgit.api.errors.GitAPIException
git - the gitstrRefSpec - the str ref specstrUserName - the str user namestrPassword - the str passwordorg.eclipse.jgit.api.errors.InvalidRemoteException - the invalid remote exceptionorg.eclipse.jgit.api.errors.TransportException - the transport exceptionorg.eclipse.jgit.api.errors.GitAPIException - the git API exceptionpublic static org.eclipse.jgit.api.PullResult pullRepoBranch(org.eclipse.jgit.api.Git git,
String sBranchName,
String strUserName,
String strPassword)
throws IOException,
org.eclipse.jgit.api.errors.WrongRepositoryStateException,
org.eclipse.jgit.api.errors.InvalidConfigurationException,
org.eclipse.jgit.api.errors.DetachedHeadException,
org.eclipse.jgit.api.errors.InvalidRemoteException,
org.eclipse.jgit.api.errors.CanceledException,
org.eclipse.jgit.api.errors.RefNotFoundException,
org.eclipse.jgit.api.errors.NoHeadException,
org.eclipse.jgit.api.errors.TransportException,
org.eclipse.jgit.api.errors.GitAPIException
git - the gitsBranchName - the s branch namestrUserName - the str user namestrPassword - the str passwordIOException - Signals that an I/O exception has occurred.org.eclipse.jgit.api.errors.WrongRepositoryStateException - the wrong repository state exceptionorg.eclipse.jgit.api.errors.InvalidConfigurationException - the invalid configuration exceptionorg.eclipse.jgit.api.errors.DetachedHeadException - the detached head exceptionorg.eclipse.jgit.api.errors.InvalidRemoteException - the invalid remote exceptionorg.eclipse.jgit.api.errors.CanceledException - the canceled exceptionorg.eclipse.jgit.api.errors.RefNotFoundException - the ref not found exceptionorg.eclipse.jgit.api.errors.NoHeadException - the no head exceptionorg.eclipse.jgit.api.errors.TransportException - the transport exceptionorg.eclipse.jgit.api.errors.GitAPIException - the git API exceptionpublic static org.eclipse.jgit.api.MergeResult mergeRepoBranch(org.eclipse.jgit.api.Git git,
String strBranchToMerge)
throws IOException,
org.eclipse.jgit.api.errors.WrongRepositoryStateException,
org.eclipse.jgit.api.errors.InvalidConfigurationException,
org.eclipse.jgit.api.errors.DetachedHeadException,
org.eclipse.jgit.api.errors.InvalidRemoteException,
org.eclipse.jgit.api.errors.CanceledException,
org.eclipse.jgit.api.errors.RefNotFoundException,
org.eclipse.jgit.api.errors.NoHeadException,
org.eclipse.jgit.api.errors.TransportException,
org.eclipse.jgit.api.errors.GitAPIException
git - the gitstrBranchToMerge - the str branch to mergeIOException - Signals that an I/O exception has occurred.org.eclipse.jgit.api.errors.WrongRepositoryStateException - the wrong repository state exceptionorg.eclipse.jgit.api.errors.InvalidConfigurationException - the invalid configuration exceptionorg.eclipse.jgit.api.errors.DetachedHeadException - the detached head exceptionorg.eclipse.jgit.api.errors.InvalidRemoteException - the invalid remote exceptionorg.eclipse.jgit.api.errors.CanceledException - the canceled exceptionorg.eclipse.jgit.api.errors.RefNotFoundException - the ref not found exceptionorg.eclipse.jgit.api.errors.NoHeadException - the no head exceptionorg.eclipse.jgit.api.errors.TransportException - the transport exceptionorg.eclipse.jgit.api.errors.GitAPIException - the git API exceptionpublic static String getLastLog(org.eclipse.jgit.api.Git git, int nMaxCommit) throws org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.GitAPIException
git - the gitnMaxCommit - the n max commitorg.eclipse.jgit.api.errors.NoHeadException - the no head exceptionorg.eclipse.jgit.api.errors.GitAPIException - the git API exceptionpublic static String getLastCommitId(org.eclipse.jgit.api.Git git) throws org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.GitAPIException
git - the gitorg.eclipse.jgit.api.errors.NoHeadException - the no head exceptionorg.eclipse.jgit.api.errors.GitAPIException - the git API exceptionpublic static org.eclipse.jgit.api.MergeResult mergeBack(org.eclipse.jgit.api.Git git,
String strUserName,
String strPassword,
CommandResult commandResult)
throws IOException,
org.eclipse.jgit.api.errors.GitAPIException
git - the gitstrUserName - the str user namestrPassword - the str passwordcommandResult - the command resultIOException - Signals that an I/O exception has occurred.org.eclipse.jgit.api.errors.GitAPIException - the git API exceptionpublic static GithubSearchResult searchRepo(String strSearch, String strOrganization, String strUserName, String strPassword)
strSearch - the str searchstrOrganization - the str organizationstrUserName - the str user namestrPassword - the str passwordpublic static String getFileContent(String strFullName, String strPathFile, String strBranch, String strUserName, String strPassword)
strFullName - the str full namestrPathFile - the str path filestrBranch - the str branchstrUserName - the str user namestrPassword - the str passwordpublic static List<String> getTagNameList(org.eclipse.jgit.api.Git git)
git - the gitpublic static String getRepoUrl(String strRepoUrl)
strRepoUrl - the str repo urlpublic static org.eclipse.jgit.api.Git getGit(String strClonePath)
strClonePath - the str clone pathCopyright © 2022 City of Paris. All rights reserved.