quietRemoteBranches, verbose| Modifier | Constructor and Description |
|---|---|
protected |
CliGitAPIImpl(String gitExe,
File workspace,
hudson.model.TaskListener listener,
hudson.EnvVars environment) |
| 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 outputStream)
Adds the changelog entries for commits in the range revFrom..revTo.
|
void |
checkout(String commit)
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) |
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) |
String |
describe(String commitIsh) |
void |
fetch() |
void |
fetch(String remoteName,
org.eclipse.jgit.transport.RefSpec refspec)
Fetch a remote repository.
|
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.
|
Set<Branch> |
getBranches() |
String |
getDefaultRemote()
Get the default remote.
|
String |
getDefaultRemote(String _default_) |
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
|
String |
getRemoteUrl(String name,
String GIT_DIR) |
org.eclipse.jgit.lib.Repository |
getRepository()
Expose the JGit repository this GitClient is using.
|
List<IndexEntry> |
getSubmodules(String treeIsh) |
String |
getSubmoduleUrl(String name)
Get submodule URL
|
String |
getTagMessage(String tagName) |
Set<String> |
getTagNames(String tagPattern) |
boolean |
hasGitModules()
Returns true if the repository has Git submodules.
|
boolean |
hasGitRepo() |
boolean |
hasGitRepo(String GIT_DIR) |
void |
init() |
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(org.eclipse.jgit.lib.ObjectId commit) |
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(org.eclipse.jgit.lib.ObjectId rev)
Merge any changes into the head.
|
void |
prune(org.eclipse.jgit.transport.RemoteConfig repository) |
void |
push(String remoteName,
String refspec) |
void |
reset(boolean hard) |
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 |
setRemoteUrl(String name,
String url,
String GIT_DIR) |
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.
|
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)
Cleans submodules
|
void |
submoduleInit() |
void |
submoduleReset(boolean recursive,
boolean hard)
Reset submodules
|
void |
submoduleSync()
Sync submodule URLs
|
void |
submoduleUpdate(boolean recursive)
Update submodules.
|
void |
tag(String tagName,
String comment)
Create (or update) a tag.
|
boolean |
tagExists(String tagName) |
org.eclipse.jgit.lib.ObjectId |
validateRevision(String revName) |
public void init()
throws GitException
init in interface GitClientGitExceptionpublic boolean hasGitRepo()
throws GitException
hasGitRepo in interface GitClientGitExceptionpublic boolean hasGitRepo(String GIT_DIR) throws GitException
GitExceptionpublic boolean hasGitModules()
throws GitException
GitClienthasGitModules in interface GitClientGitExceptionpublic List<IndexEntry> getSubmodules(String treeIsh) throws GitException
getSubmodules in interface GitClientGitExceptionpublic void fetch(String remoteName, org.eclipse.jgit.transport.RefSpec refspec) throws GitException
GitClientfetch in interface GitClientGitExceptionpublic void fetch()
throws GitException
GitExceptionpublic void reset(boolean hard)
throws GitException
GitExceptionpublic void clone(String url, String origin, boolean useShallowClone, String reference) throws GitException
GitClientclone 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)GitExceptionpublic void clean()
throws GitException
GitClientclean in interface GitClientGitExceptionpublic org.eclipse.jgit.lib.ObjectId revParse(String revName) throws GitException
GitClientrevParse in interface GitClientrevName - a commit sha1 or tag/branch refnameGitException - when no such commit / revName is found in repository.public org.eclipse.jgit.lib.ObjectId validateRevision(String revName) throws GitException
GitExceptionpublic String describe(String commitIsh) throws GitException
GitExceptionpublic void prune(org.eclipse.jgit.transport.RemoteConfig repository)
throws GitException
prune in interface GitClientGitExceptionpublic void changelog(String revFrom, String revTo, OutputStream outputStream) throws GitException
GitClientchangelog in interface GitClientGitExceptionpublic List<String> showRevision(org.eclipse.jgit.lib.ObjectId r) throws GitException
showRevision in interface GitClientGitExceptionpublic 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 GitClientGitExceptionpublic void merge(org.eclipse.jgit.lib.ObjectId rev)
throws GitException
merge in interface GitClientrev - the revisionGitException - if the emrge failspublic void submoduleInit()
throws GitException
GitExceptionpublic void addSubmodule(String remoteURL, String subdir) throws GitException
GitClientaddSubmodule in interface GitClientGitExceptionpublic void submoduleSync()
throws GitException
GitExceptionpublic void submoduleUpdate(boolean recursive)
throws GitException
submoduleUpdate in interface GitClientrecursive - if true, will recursively update submodules (requires git>=1.6.5)GitException - if executing the Git command failspublic void submoduleReset(boolean recursive,
boolean hard)
throws GitException
recursive - if true, will recursively reset submodules (requres git>=1.6.5)GitException - if executing the git command failspublic void submoduleClean(boolean recursive)
throws GitException
submoduleClean in interface GitClientrecursive - if true, will recursively clean submodules (requres git>=1.6.5)GitException - if executing the git command failspublic String getSubmoduleUrl(String name) throws GitException
name - The name of the submoduleGitException - if executing the git command failspublic void setSubmoduleUrl(String name, String url) throws GitException
name - 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
GitClientgetRemoteUrl in interface GitClientname - The name of the remote (e.g. origin)GitException - if executing the git command failspublic void setRemoteUrl(String name, String url) throws GitException
GitClientsetRemoteUrl in interface GitClientname - 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
GitExceptionpublic void setRemoteUrl(String name, String url, String GIT_DIR) throws GitException
GitExceptionpublic String getDefaultRemote(String _default_) throws GitException
GitExceptionpublic String getDefaultRemote() throws GitException
GitException - if executing the git command failspublic boolean isBareRepository()
throws GitException
GitExceptionpublic boolean isBareRepository(String GIT_DIR) throws GitException
GIT_DIR - The path to the repository (must be to .git dir).GitExceptionpublic void fixSubmoduleUrls(String remote, hudson.model.TaskListener listener) throws GitException
listener - The task listener.GitException - if executing the git command failspublic void setupSubmoduleUrls(Revision rev, hudson.model.TaskListener listener) throws GitException
setupSubmoduleUrls in interface GitClientGitExceptionpublic void tag(String tagName, String comment) throws GitException
GitClienttag in interface GitClientGitExceptionpublic void appendNote(String note, String namespace) throws GitException
appendNote in interface GitClientGitExceptionpublic void addNote(String note, String namespace) throws GitException
addNote in interface GitClientGitExceptionpublic String launchCommand(hudson.util.ArgumentListBuilder args) throws GitException
args - GitExceptionpublic String launchCommand(String... args) throws GitException
args - GitExceptionpublic void push(String remoteName, String refspec) throws GitException
push in interface GitClientGitExceptionpublic Set<Branch> getBranches() throws GitException
getBranches in interface GitClientGitExceptionpublic Set<Branch> getRemoteBranches() throws GitException
getRemoteBranches in interface GitClientGitExceptionpublic void checkout(String commit) throws GitException
GitClientcheckout in interface GitClientcommit - A git object references expression (either a sha1, tag or branch)GitExceptionpublic void checkout(String ref, String branch) throws GitException
GitClientcheckout in interface GitClientref - A git object references expression. For backward compatibility, null will checkout current HEADbranch - name of the branch to create from referenceGitExceptionpublic 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 GitClientGitExceptionpublic boolean tagExists(String tagName) throws GitException
tagExists in interface GitClientGitExceptionpublic void deleteBranch(String name) throws GitException
GitClientdeleteBranch in interface GitClientGitExceptionpublic void deleteTag(String tagName) throws GitException
deleteTag in interface GitClientGitExceptionpublic List<IndexEntry> lsTree(String treeIsh) throws GitException
GitExceptionpublic List<org.eclipse.jgit.lib.ObjectId> revListAll() throws GitException
revListAll in interface GitClientGitExceptionpublic List<org.eclipse.jgit.lib.ObjectId> revList(String ref) throws GitException
revList in interface GitClientGitExceptionpublic boolean isCommitInRepo(org.eclipse.jgit.lib.ObjectId commit)
isCommitInRepo in interface GitClientpublic void add(String filePattern) throws GitException
add in interface GitClientGitExceptionpublic void branch(String name) throws GitException
branch in interface GitClientGitExceptionpublic void commit(String message) throws GitException
commit in interface GitClientGitExceptionpublic void commit(String message, org.eclipse.jgit.lib.PersonIdent author, org.eclipse.jgit.lib.PersonIdent committer) throws GitException
commit in interface GitClientGitExceptionpublic org.eclipse.jgit.lib.Repository getRepository()
throws GitException
GitClientRepository.close(), to avoid JENKINS-12188.getRepository in interface GitClientGitExceptionpublic Set<String> getTagNames(String tagPattern) throws GitException
getTagNames in interface GitClientGitExceptionpublic String getTagMessage(String tagName) throws GitException
getTagMessage in interface GitClientGitExceptionpublic org.eclipse.jgit.lib.ObjectId getHeadRev(String remoteRepoUrl, String branch) throws GitException
getHeadRev in interface GitClientGitExceptionCopyright © 2004-2013. All Rights Reserved.