public interface GitClient
| Modifier and Type | Field and Description |
|---|---|
static boolean |
quietRemoteBranches |
static boolean |
verbose |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String filePattern) |
void |
addNote(String note,
String namespace) |
void |
addSubmodule(String remoteURL,
String subdir)
Create a submodule in subdir child directory for remote repository
|
void |
appendNote(String note,
String namespace) |
void |
branch(String name) |
void |
changelog(String revFrom,
String revTo,
OutputStream fos)
Adds the changelog entries for commits in the range revFrom..revTo.
|
void |
checkout(String ref)
Checks out the specified commit/tag/branch into the workspace.
|
void |
checkout(String ref,
String branch)
Creates a new branch that points to the specified ref.
|
void |
checkoutBranch(String branch,
String ref)
Regardless of the current state of the workspace (whether there is some dirty files, etc)
and the state of the repository (whether the branch of the specified name exists or not),
when this method exits the following conditions hold:
The branch of the specified name branch exists and points to the specified ref
HEAD points to branch.
|
void |
clean()
Fully revert working copy to a clean state, i.e.
|
void |
clone(String url,
String origin,
boolean useShallowClone,
String reference)
Clone a remote repository
|
void |
commit(String message)
Deprecated.
use
commit(String, org.eclipse.jgit.lib.PersonIdent, org.eclipse.jgit.lib.PersonIdent) as
this method is environment dependent to have GIT_AUTHOR/COMMITTER set |
void |
commit(String message,
org.eclipse.jgit.lib.PersonIdent author,
org.eclipse.jgit.lib.PersonIdent committer) |
void |
deleteBranch(String name)
(force) delete a branch.
|
void |
deleteTag(String tagName) |
void |
fetch(String remoteName,
org.eclipse.jgit.transport.RefSpec refspec)
Fetch a remote repository.
|
Set<Branch> |
getBranches() |
org.eclipse.jgit.lib.ObjectId |
getHeadRev(String remoteRepoUrl,
String branch) |
Set<Branch> |
getRemoteBranches() |
String |
getRemoteUrl(String name)
From a given repository, get a remote's URL
|
org.eclipse.jgit.lib.Repository |
getRepository()
Expose the JGit repository this GitClient is using.
|
List<IndexEntry> |
getSubmodules(String treeIsh) |
String |
getTagMessage(String tagName) |
Set<String> |
getTagNames(String tagPattern) |
boolean |
hasGitModules()
Returns true if the repository has Git submodules.
|
boolean |
hasGitRepo() |
void |
init() |
boolean |
isCommitInRepo(org.eclipse.jgit.lib.ObjectId commit) |
void |
merge(org.eclipse.jgit.lib.ObjectId rev) |
void |
prune(org.eclipse.jgit.transport.RemoteConfig repository) |
void |
push(String remoteName,
String refspec) |
List<org.eclipse.jgit.lib.ObjectId> |
revList(String ref) |
List<org.eclipse.jgit.lib.ObjectId> |
revListAll() |
org.eclipse.jgit.lib.ObjectId |
revParse(String revName)
Retrieve commit object that is direct child for revName revision reference.
|
void |
setRemoteUrl(String name,
String url)
For a given repository, set a remote's 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.
|
List<String> |
showRevision(org.eclipse.jgit.lib.ObjectId r) |
List<String> |
showRevision(org.eclipse.jgit.lib.ObjectId from,
org.eclipse.jgit.lib.ObjectId to)
Given a Revision, show it as if it were an entry from git whatchanged, so that it
can be parsed by GitChangeLogParser.
|
GitClient |
subGit(String subdir) |
void |
submoduleClean(boolean recursive) |
void |
submoduleUpdate(boolean recursive) |
void |
tag(String tagName,
String comment)
Create (or update) a tag.
|
boolean |
tagExists(String tagName) |
static final boolean verbose
static final boolean quietRemoteBranches
org.eclipse.jgit.lib.Repository getRepository()
throws GitException
Repository.close(), to avoid JENKINS-12188.GitExceptionvoid init()
throws GitException
GitExceptionvoid add(String filePattern) throws GitException
GitExceptionvoid commit(String message) throws GitException
commit(String, org.eclipse.jgit.lib.PersonIdent, org.eclipse.jgit.lib.PersonIdent) as
this method is environment dependent to have GIT_AUTHOR/COMMITTER setGitExceptionvoid commit(String message, org.eclipse.jgit.lib.PersonIdent author, org.eclipse.jgit.lib.PersonIdent committer) throws GitException
GitExceptionboolean hasGitRepo()
throws GitException
GitExceptionboolean isCommitInRepo(org.eclipse.jgit.lib.ObjectId commit)
throws GitException
GitExceptionString getRemoteUrl(String name) throws GitException
name - The name of the remote (e.g. origin)GitException - if executing the git command failsvoid setRemoteUrl(String name, String url) throws GitException
name - The name of the remote (e.g. origin)url - The new value of the remote's URLGitException - if executing the git command failsvoid checkout(String ref) throws GitException
ref - A git object references expression (either a sha1, tag or branch)GitExceptionvoid checkout(String ref, String branch) throws GitException
ref - A git object references expression. For backward compatibility, null will checkout current HEADbranch - name of the branch to create from referenceGitExceptionvoid checkoutBranch(String branch, String ref) throws GitException
This method is preferred over the checkout(String, String) family of methods, as
this method is affected far less by the current state of the repository. The checkout
methods, in their attempt to emulate the "git checkout" command line behaviour, have too many
side effects. In Jenkins, where you care a lot less about throwing away local changes and
care a lot more about resetting the workspace into a known state, methods like this is more useful.
For compatibility reasons, the order of the parameter is different from checkout(String, String).
GitExceptionvoid clone(String url, String origin, boolean useShallowClone, String reference) throws GitException
url - URL for remote repository to cloneorigin - upstream track name, defaults to origin by conventionuseShallowClone - option to create a shallow clone, that has some restriction but will make clone operationreference - (optional) reference to a local clone for faster clone operations (reduce network and local storage costs)GitExceptionvoid fetch(String remoteName, org.eclipse.jgit.transport.RefSpec refspec) throws GitException
GitExceptionvoid push(String remoteName, String refspec) throws GitException
GitExceptionvoid merge(org.eclipse.jgit.lib.ObjectId rev)
throws GitException
GitExceptionvoid prune(org.eclipse.jgit.transport.RemoteConfig repository)
throws GitException
GitExceptionvoid clean()
throws GitException
GitExceptionvoid branch(String name) throws GitException
GitExceptionvoid deleteBranch(String name) throws GitException
GitExceptionSet<Branch> getBranches() throws GitException
GitExceptionSet<Branch> getRemoteBranches() throws GitException
GitExceptionvoid tag(String tagName, String comment) throws GitException
GitExceptionboolean tagExists(String tagName) throws GitException
GitExceptionString getTagMessage(String tagName) throws GitException
GitExceptionvoid deleteTag(String tagName) throws GitException
GitExceptionSet<String> getTagNames(String tagPattern) throws GitException
GitExceptionorg.eclipse.jgit.lib.ObjectId getHeadRev(String remoteRepoUrl, String branch) throws GitException
GitExceptionorg.eclipse.jgit.lib.ObjectId revParse(String revName) throws GitException
revName - a commit sha1 or tag/branch refnameGitException - when no such commit / revName is found in repository.List<org.eclipse.jgit.lib.ObjectId> revListAll() throws GitException
GitExceptionList<org.eclipse.jgit.lib.ObjectId> revList(String ref) throws GitException
GitExceptionGitClient subGit(String subdir)
boolean hasGitModules()
throws GitException
GitExceptionList<IndexEntry> getSubmodules(String treeIsh) throws GitException
GitExceptionvoid addSubmodule(String remoteURL, String subdir) throws GitException
GitExceptionvoid submoduleUpdate(boolean recursive)
throws GitException
GitExceptionvoid submoduleClean(boolean recursive)
throws GitException
GitExceptionvoid setupSubmoduleUrls(Revision rev, hudson.model.TaskListener listener) throws GitException
GitExceptionvoid changelog(String revFrom, String revTo, OutputStream fos) throws GitException
GitExceptionvoid appendNote(String note, String namespace) throws GitException
GitExceptionvoid addNote(String note, String namespace) throws GitException
GitExceptionList<String> showRevision(org.eclipse.jgit.lib.ObjectId r) throws GitException
GitExceptionList<String> showRevision(org.eclipse.jgit.lib.ObjectId from, org.eclipse.jgit.lib.ObjectId to) throws GitException
Changes are computed on the [from..to] range.
GitExceptionCopyright © 2004-2013. All Rights Reserved.