| Constructor and Description |
|---|
GitAPI(String gitExe,
hudson.FilePath workspace,
hudson.model.TaskListener listener,
hudson.EnvVars environment) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String filePattern) |
void |
branch(String name) |
void |
changelog(String revFrom,
String revTo,
OutputStream outputStream) |
void |
checkout(String commitish)
Short for
checkoutBranch(null, commitish) |
void |
checkoutBranch(String branch,
String commitish)
Checks out the specified commit/ref into the workspace.
|
void |
clean() |
void |
clone_cgit(org.eclipse.jgit.transport.RemoteConfig remoteConfig)
Start from scratch and clone the whole repository.
|
void |
clone(org.eclipse.jgit.transport.RemoteConfig remoteConfig) |
void |
close()
Close the underlying Git object.
|
void |
commit(File f) |
void |
commit(String message)
Performs commit into repository with given message.
|
void |
deleteBranch(String name) |
void |
deleteTag(String tagName) |
String |
describe(String commitIsh) |
void |
fetch() |
void |
fetch(org.eclipse.jgit.transport.RemoteConfig remoteRepository) |
void |
fetch(String repository,
String refspec) |
void |
fixSubmoduleUrls(String remote,
hudson.model.TaskListener listener)
Fixes urls for submodule as stored in .git/config and
$SUBMODULE/.git/config for when the remote repo is NOT a bare repository.
|
String |
getAllLogEntries(String branch) |
protected org.eclipse.jgit.lib.PersonIdent |
getAuthor()
Returns author
|
List<Branch> |
getBranches() |
List<Branch> |
getBranchesContaining(String revspec) |
protected org.eclipse.jgit.lib.PersonIdent |
getCommitter()
Returns committer
|
String |
getDefaultRemote()
Get the default remote.
|
String |
getDefaultRemote(String _default_)
Get the default remote.
|
hudson.EnvVars |
getEnvironment() |
String |
getGitExe() |
String |
getHeadRev(String remoteRepoUrl,
String branch) |
List<Branch> |
getRemoteBranches() |
String |
getRemoteUrl(String name)
Get a remote's URL
|
String |
getRemoteUrl(String name,
String GIT_DIR)
From a given repository, get a remote's URL
|
protected org.eclipse.jgit.lib.Repository |
getRepository() |
List<IndexEntry> |
getSubmodules(String treeIsh) |
String |
getSubmoduleUrl(String name)
Get submodule URL
|
Set<String> |
getTagNames(String tagPattern) |
List<Tag> |
getTagsOnCommit(String revName) |
boolean |
hasGitModules() |
boolean |
hasGitModules(String treeIsh) |
boolean |
hasGitRepo()
Checks whether .git directory exists
|
boolean |
hasGitRepo(String gitDir) |
void |
init()
Inits git repository.
|
boolean |
isBareRepository()
Detect whether a repository is bare or not.
|
boolean |
isBareRepository(String GIT_DIR)
Detect whether a repository at the given path is bare or not.
|
boolean |
isCommitInRepo(String sha1)
Checks whether commit presents in repository.
|
String |
launchCommand(hudson.util.ArgumentListBuilder args)
Launch command using the workspace as working directory
|
String |
launchCommand(String... args)
Launch command using the workspace as working directory
|
List<IndexEntry> |
lsTree(String treeIsh) |
void |
merge(String revSpec)
Merge any changes into the head.
|
org.eclipse.jgit.lib.ObjectId |
mergeBase(org.eclipse.jgit.lib.ObjectId id1,
org.eclipse.jgit.lib.ObjectId id2) |
protected void |
parseEnvVars(hudson.EnvVars envVars)
Check environment variables for authors and committers data.
|
protected List<Branch> |
parseRefList(List<org.eclipse.jgit.lib.Ref> refList) |
void |
prune(org.eclipse.jgit.transport.RemoteConfig repository) |
void |
push(org.eclipse.jgit.transport.RemoteConfig repository,
String refspec) |
List<org.eclipse.jgit.lib.ObjectId> |
revList(String... extraArgs) |
List<org.eclipse.jgit.lib.ObjectId> |
revListAll() |
List<org.eclipse.jgit.lib.ObjectId> |
revListBranch(String branchId) |
org.eclipse.jgit.lib.ObjectId |
revParse(String revName) |
void |
setRemoteUrl(String name,
String url)
Set a remote's URL
|
void |
setRemoteUrl(String name,
String url,
String GIT_DIR)
For a given repository, set a remote's URL
|
void |
setSubmoduleUrl(String name,
String url)
Set submodule URL
|
void |
setupSubmoduleUrls(Revision rev,
hudson.model.TaskListener listener)
Set up submodule URLs so that they correspond to the remote pertaining to
the revision that has been checked out.
|
void |
setupSubmoduleUrls(String remote,
hudson.model.TaskListener listener) |
List<String> |
showRevision(Revision r)
Given a Revision, show it as if it were an entry from git whatchanged, so that it
can be parsed by GitChangeLogParser.
|
void |
submoduleClean(boolean recursive)
Cleans submodules
|
void |
submoduleInit()
Init submodules.
|
void |
submoduleSync()
Sync submodule URLs
|
void |
submoduleUpdate(boolean recursive)
Update submodules.
|
void |
tag(String tagName,
String comment) |
boolean |
tagExists(String tagName) |
public GitAPI(String gitExe, hudson.FilePath workspace, hudson.model.TaskListener listener, hudson.EnvVars environment)
public void close()
commit is allowed.protected org.eclipse.jgit.lib.PersonIdent getAuthor()
PersonIdentprotected org.eclipse.jgit.lib.PersonIdent getCommitter()
PersonIdentpublic hudson.EnvVars getEnvironment()
getEnvironment in interface IGitAPIpublic void init()
throws GitException
IGitAPIinit in interface IGitAPIGitException - if repository exists.public boolean hasGitRepo()
throws GitException
IGitAPIhasGitRepo in interface IGitAPIGitException - if any.public boolean hasGitRepo(String gitDir) throws GitException
GitExceptionpublic boolean hasGitModules()
throws GitException
hasGitModules in interface IGitAPIGitExceptionpublic List<IndexEntry> getSubmodules(String treeIsh) throws GitException
getSubmodules in interface IGitAPIGitExceptionpublic boolean hasGitModules(String treeIsh) throws GitException
hasGitModules in interface IGitAPIGitExceptionpublic void fetch(String repository, String refspec) throws GitException
fetch in interface IGitAPIGitExceptionpublic void fetch()
throws GitException
fetch in interface IGitAPIGitExceptionpublic void clone_cgit(org.eclipse.jgit.transport.RemoteConfig remoteConfig)
throws GitException
clone_cgit in interface IGitAPIremoteConfig - remote configGitException - if deleting or cloning the workspace failspublic void clone(org.eclipse.jgit.transport.RemoteConfig remoteConfig)
throws GitException
clone in interface IGitAPIGitExceptionpublic void clean()
throws GitException
clean in interface IGitAPIGitExceptionpublic org.eclipse.jgit.lib.ObjectId revParse(String revName) throws GitException
revParse in interface IGitAPIGitExceptionpublic String describe(String commitIsh) throws GitException
describe in interface IGitAPIGitExceptionpublic void prune(org.eclipse.jgit.transport.RemoteConfig repository)
throws GitException
prune in interface IGitAPIGitExceptionpublic void changelog(String revFrom, String revTo, OutputStream outputStream) throws GitException
changelog in interface IGitAPIGitExceptionpublic List<String> showRevision(Revision r) throws GitException
showRevision in interface IGitAPIr - The Revision objectGitException - if errors were encountered running git show.public void merge(String revSpec) throws GitException
merge in interface IGitAPIrevSpec - the revisionGitException - if the emrge failspublic void submoduleInit()
throws GitException
submoduleInit in interface IGitAPIGitException - if executing the Git command failspublic void submoduleSync()
throws GitException
submoduleSync in interface IGitAPIGitExceptionpublic void submoduleUpdate(boolean recursive)
throws GitException
submoduleUpdate in interface IGitAPIrecursive - if true, will recursively update submodules (requires git>=1.6.5)GitException - if executing the Git command failspublic void submoduleClean(boolean recursive)
throws GitException
submoduleClean in interface IGitAPIrecursive - if true, will recursively clean submodules (requres git>=1.6.5)GitException - if executing the git command failspublic String getSubmoduleUrl(String name) throws GitException
getSubmoduleUrl in interface IGitAPIname - The name of the submoduleGitException - if executing the git command failspublic void setSubmoduleUrl(String name, String url) throws GitException
setSubmoduleUrl in interface IGitAPIname - The name of the submoduleurl - The new value of the submodule's URLGitException - if executing the git command failspublic String getRemoteUrl(String name) throws GitException
getRemoteUrl in interface IGitAPIname - The name of the remote (e.g. origin)GitException - if executing the git command failspublic void setRemoteUrl(String name, String url) throws GitException
setRemoteUrl in interface IGitAPIname - The name of the remote (e.g. origin)url - The new value of the remote's URLGitException - if executing the git command failspublic String getRemoteUrl(String name, String GIT_DIR) throws GitException
getRemoteUrl in interface IGitAPIname - The name of the remote (e.g. origin)GIT_DIR - The path to the repository (must be to .git dir)GitException - if executing the git command failspublic void setRemoteUrl(String name, String url, String GIT_DIR) throws GitException
setRemoteUrl in interface IGitAPIname - The name of the remote (e.g. origin)url - The new value of the remote's URLGIT_DIR - The path to the repository (must be to .git dir)GitException - if executing the git command failspublic String getDefaultRemote(String _default_) throws GitException
getDefaultRemote in interface IGitAPI_default_ - The default remote to use if more than one exists.GitException - if executing the git command failspublic String getDefaultRemote() throws GitException
GitException - if executing the git command failspublic boolean isBareRepository()
throws GitException
isBareRepository in interface IGitAPIGitExceptionpublic boolean isBareRepository(String GIT_DIR) throws GitException
isBareRepository in interface IGitAPIGIT_DIR - The path to the repository (must be to .git dir).GitExceptionpublic void fixSubmoduleUrls(String remote, hudson.model.TaskListener listener) throws GitException
fixSubmoduleUrls in interface IGitAPIlistener - The task listener.GitException - if executing the git command failspublic void setupSubmoduleUrls(Revision rev, hudson.model.TaskListener listener) throws GitException
setupSubmoduleUrls in interface IGitAPIGitExceptionpublic void setupSubmoduleUrls(String remote, hudson.model.TaskListener listener) throws GitException
setupSubmoduleUrls in interface IGitAPIGitExceptionpublic void tag(String tagName, String comment) throws GitException
tag in interface IGitAPIGitExceptionpublic String launchCommand(hudson.util.ArgumentListBuilder args) throws GitException
args - GitExceptionpublic String launchCommand(String... args) throws GitException
args - GitExceptionpublic void push(org.eclipse.jgit.transport.RemoteConfig repository,
String refspec)
throws GitException
push in interface IGitAPIGitExceptionpublic List<Branch> getBranches() throws GitException
getBranches in interface IGitAPIGitExceptionpublic List<Branch> getRemoteBranches() throws GitException, IOException
getRemoteBranches in interface IGitAPIGitExceptionIOExceptionpublic List<Branch> getBranchesContaining(String revspec) throws GitException
getBranchesContaining in interface IGitAPIGitExceptionpublic void checkout(String commitish) throws GitException
IGitAPIcheckoutBranch(null, commitish)checkout in interface IGitAPIcommitish - commitish value.GitException - if any.public void checkoutBranch(String branch, String commitish) throws GitException
IGitAPIcheckoutBranch in interface IGitAPIbranch - If non-null, move/create the branch in this name at the specified commit-ish and check out that branch.commitish - commitish value.GitException - if any.public boolean tagExists(String tagName) throws GitException
tagExists in interface IGitAPIGitExceptionpublic void deleteBranch(String name) throws GitException
deleteBranch in interface IGitAPIGitExceptionpublic void deleteTag(String tagName) throws GitException
deleteTag in interface IGitAPIGitExceptionpublic List<IndexEntry> lsTree(String treeIsh) throws GitException
lsTree in interface IGitAPIGitExceptionpublic List<org.eclipse.jgit.lib.ObjectId> revListAll() throws GitException
revListAll in interface IGitAPIGitExceptionpublic List<org.eclipse.jgit.lib.ObjectId> revListBranch(String branchId) throws GitException
revListBranch in interface IGitAPIGitExceptionpublic List<org.eclipse.jgit.lib.ObjectId> revList(String... extraArgs) throws GitException
GitExceptionpublic boolean isCommitInRepo(String sha1)
IGitAPIisCommitInRepo in interface IGitAPIsha1 - commitpublic void add(String filePattern) throws GitException
add in interface IGitAPIGitExceptionpublic void branch(String name) throws GitException
branch in interface IGitAPIGitExceptionpublic void commit(String message) throws GitException
IGitAPIcommit in interface IGitAPImessage - commit message.GitException - if any.public void commit(File f) throws GitException
commit in interface IGitAPIf - file with commit message.GitException - if any.public void fetch(org.eclipse.jgit.transport.RemoteConfig remoteRepository)
throws GitException
fetch in interface IGitAPIGitExceptionpublic org.eclipse.jgit.lib.ObjectId mergeBase(org.eclipse.jgit.lib.ObjectId id1,
org.eclipse.jgit.lib.ObjectId id2)
public String getAllLogEntries(String branch)
getAllLogEntries in interface IGitAPIprotected org.eclipse.jgit.lib.Repository getRepository()
throws IOException
IOExceptionpublic List<Tag> getTagsOnCommit(String revName) throws GitException, IOException
getTagsOnCommit in interface IGitAPIGitExceptionIOExceptionpublic Set<String> getTagNames(String tagPattern) throws GitException
getTagNames in interface IGitAPIGitExceptionprotected void parseEnvVars(hudson.EnvVars envVars)
PersonIdentenvVars - environment variables.GitConstants.GIT_AUTHOR_NAME_ENV_VAR,
GitConstants.GIT_AUTHOR_EMAIL_ENV_VAR,
GitConstants.GIT_COMMITTER_NAME_ENV_VAR,
GitConstants.GIT_COMMITTER_EMAIL_ENV_VARpublic String getHeadRev(String remoteRepoUrl, String branch) throws GitException
getHeadRev in interface IGitAPIGitExceptionCopyright © 2004-2015 Hudson. All Rights Reserved.