|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jenkinsci.plugins.gitclient.JGitAPIImpl
public class JGitAPIImpl
GitClient pure Java implementation using JGit.
Goal is to eventually get a full java implementation for GitClient
For internal use only, don't use directly. See Git
| Field Summary |
|---|
| Fields inherited from interface org.jenkinsci.plugins.gitclient.GitClient |
|---|
quietRemoteBranches, verbose |
| Method Summary | |
|---|---|
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. run both git-reset(1) --hard then git-clean(1) for working copy to match a fresh clone. |
void |
clone(String url,
String origin,
boolean useShallowClone,
String reference)
Clone a remote repository |
void |
commit(String message)
|
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 name,
String message)
Create (or update) a tag. |
boolean |
tagExists(String tagName)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public GitClient subGit(String subdir)
subGit in interface GitClient
public void init()
throws GitException
init in interface GitClientGitException
public void checkout(String ref)
throws GitException
GitClient
checkout in interface GitClientref - A git object references expression (either a sha1, tag or branch)
GitException
public void checkout(String ref,
String branch)
throws GitException
GitClient
checkout in interface GitClientref - A git object references expression. For backward compatibility, null will checkout current HEADbranch - name of the branch to create from reference
GitException
public void checkoutBranch(String branch,
String ref)
throws GitException
GitClient
This method is preferred over the GitClient.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 GitClient.checkout(String, String).
checkoutBranch in interface GitClientGitException
public void add(String filePattern)
throws GitException
add in interface GitClientGitException
public void commit(String message)
throws GitException
commit in interface GitClientGitException
public void commit(String message,
org.eclipse.jgit.lib.PersonIdent author,
org.eclipse.jgit.lib.PersonIdent committer)
throws GitException
commit in interface GitClientGitException
public void branch(String name)
throws GitException
branch in interface GitClientGitException
public void deleteBranch(String name)
throws GitException
GitClient
deleteBranch in interface GitClientGitException
public Set<Branch> getBranches()
throws GitException
getBranches in interface GitClientGitException
public Set<Branch> getRemoteBranches()
throws GitException
getRemoteBranches in interface GitClientGitException
public void tag(String name,
String message)
throws GitException
GitClient
tag in interface GitClientGitException
public boolean tagExists(String tagName)
throws GitException
tagExists in interface GitClientGitException
public void fetch(String remoteName,
org.eclipse.jgit.transport.RefSpec refspec)
throws GitException
GitClient
fetch in interface GitClientGitException
public org.eclipse.jgit.lib.ObjectId getHeadRev(String remoteRepoUrl,
String branch)
throws GitException
getHeadRev in interface GitClientGitException
public String getRemoteUrl(String name)
throws GitException
GitClient
getRemoteUrl in interface GitClientname - The name of the remote (e.g. origin)
GitException - if executing the git command fails
public org.eclipse.jgit.lib.Repository getRepository()
throws GitException
GitClientRepository.close(), to avoid JENKINS-12188.
getRepository in interface GitClientGitException
public void merge(org.eclipse.jgit.lib.ObjectId rev)
throws GitException
merge in interface GitClientGitException
public void setRemoteUrl(String name,
String url)
throws GitException
GitClient
setRemoteUrl in interface GitClientname - The name of the remote (e.g. origin)url - The new value of the remote's URL
GitException - if executing the git command fails
public void addNote(String note,
String namespace)
throws GitException
addNote in interface GitClientGitException
public void appendNote(String note,
String namespace)
throws GitException
appendNote in interface GitClientGitException
public void changelog(String revFrom,
String revTo,
OutputStream fos)
throws GitException
GitClient
changelog in interface GitClientGitException
public void clean()
throws GitException
GitClient
clean in interface GitClientGitException
public void clone(String url,
String origin,
boolean useShallowClone,
String reference)
throws GitException
GitClient
clone in interface GitClienturl - 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)
GitException
public void deleteTag(String tagName)
throws GitException
deleteTag in interface GitClientGitException
public String getTagMessage(String tagName)
throws GitException
getTagMessage in interface GitClientGitException
public List<IndexEntry> getSubmodules(String treeIsh)
throws GitException
getSubmodules in interface GitClientGitException
public void addSubmodule(String remoteURL,
String subdir)
throws GitException
GitClient
addSubmodule in interface GitClientGitException
public Set<String> getTagNames(String tagPattern)
throws GitException
getTagNames in interface GitClientGitException
public boolean hasGitModules()
throws GitException
GitClient
hasGitModules in interface GitClientGitException
public boolean hasGitRepo()
throws GitException
hasGitRepo in interface GitClientGitException
public boolean isCommitInRepo(org.eclipse.jgit.lib.ObjectId commit)
throws GitException
isCommitInRepo in interface GitClientGitException
public void prune(org.eclipse.jgit.transport.RemoteConfig repository)
throws GitException
prune in interface GitClientGitException
public void push(String remoteName,
String refspec)
throws GitException
push in interface GitClientGitException
public List<org.eclipse.jgit.lib.ObjectId> revListAll()
throws GitException
revListAll in interface GitClientGitException
public List<org.eclipse.jgit.lib.ObjectId> revList(String ref)
throws GitException
revList in interface GitClientGitException
public org.eclipse.jgit.lib.ObjectId revParse(String revName)
throws GitException
GitClient
revParse in interface GitClientrevName - a commit sha1 or tag/branch refname
GitException - when no such commit / revName is found in repository.
public void setupSubmoduleUrls(Revision rev,
hudson.model.TaskListener listener)
throws GitException
GitClient
setupSubmoduleUrls in interface GitClientGitException
public List<String> showRevision(org.eclipse.jgit.lib.ObjectId r)
throws GitException
showRevision in interface GitClientGitException
public List<String> showRevision(org.eclipse.jgit.lib.ObjectId from,
org.eclipse.jgit.lib.ObjectId to)
throws GitException
GitClientChanges are computed on the [from..to] range.
showRevision in interface GitClientGitException
public void submoduleClean(boolean recursive)
throws GitException
submoduleClean in interface GitClientGitException
public void submoduleUpdate(boolean recursive)
throws GitException
submoduleUpdate in interface GitClientGitException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||