public class JGitAPIImpl extends Object
Git
| Modifier and Type | Field and Description |
|---|---|
protected hudson.ProxyConfiguration |
proxy |
protected File |
workspace |
CREDENTIALS_MATCHER, quietRemoteBranches, verbose| Modifier and Type | Method and Description |
|---|---|
void |
add(String filePattern)
add.
|
void |
addCredentials(String url,
com.cloudbees.plugins.credentials.common.StandardCredentials credentials)
Adds credentials to be used against a specific url.
|
void |
addDefaultCredentials(com.cloudbees.plugins.credentials.common.StandardCredentials credentials)
Adds credentials to be used when there are not url specific credentials defined.
|
void |
addNote(String note,
String namespace)
Adds a new git-note on the current HEAD commit.
|
void |
addRemoteUrl(String name,
String url)
addRemoteUrl.
|
void |
addSubmodule(String remoteURL,
String subdir)
Create a submodule in subdir child directory for remote repository
|
void |
appendNote(String note,
String namespace)
Appends to an existing git-note on the current HEAD commit.
|
void |
branch(String name)
branch.
|
ChangelogCommand |
changelog()
changelog.
|
void |
changelog(String revFrom,
String revTo,
OutputStream outputStream)
changelog.
|
void |
changelog(String revFrom,
String revTo,
Writer w)
Adds the changelog entries for commits in the range revFrom..revTo.
|
CheckoutCommand |
checkout()
checkout.
|
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()
clean.
|
void |
clean(boolean cleanSubmodule)
clean.
|
void |
clearCredentials()
clearCredentials.
|
CloneCommand |
clone_()
clone_.
|
void |
clone(RemoteConfig source)
Deprecated.
|
void |
clone(RemoteConfig rc,
boolean useShallowClone)
Deprecated.
|
void |
clone(String url,
String origin,
boolean useShallowClone,
String reference)
Clone a remote repository
|
void |
commit(String message)
commit.
|
void |
commit(String message,
PersonIdent author,
PersonIdent committer)
commit.
|
void |
deleteBranch(String name)
(force) delete a branch.
|
void |
deleteRef(String refName)
Deletes a ref.
|
void |
deleteTag(String tagName)
deleteTag.
|
String |
describe(String tip)
Equivalent of "git-describe --tags".
|
protected String |
extractBranchNameFromBranchSpec(String branchSpec)
This method takes a branch specification and normalizes it get unambiguous results.
|
FetchCommand |
fetch_()
fetch_.
|
void |
fetch()
Deprecated.
|
void |
fetch(RemoteConfig remoteRepository)
Deprecated.
|
void |
fetch(String remoteName,
RefSpec... refspec)
fetch.
|
void |
fetch(String remoteName,
RefSpec refspec)
fetch.
|
void |
fetch(String repository,
String refspec)
Deprecated.
|
void |
fetch(URIish url,
List<RefSpec> refspecs)
Fetch commits from url which match any of the passed in
refspecs.
|
void |
fixSubmoduleUrls(String remote,
hudson.model.TaskListener listener)
Deprecated.
|
String |
getAllLogEntries(String branch)
Deprecated.
|
Set<Branch> |
getBranches()
getBranches.
|
List<Branch> |
getBranchesContaining(String revspec)
Find all the branches that include the given commit.
|
List<Branch> |
getBranchesContaining(String revspec,
boolean allBranches)
Find all the branches that include the given commit.
|
Set<Branch> |
getBranchesInternal(ListBranchCommand.ListMode mode) |
String |
getDefaultRemote(String _default_)
Deprecated.
|
Map<String,ObjectId> |
getHeadRev(String url)
getHeadRev.
|
ObjectId |
getHeadRev(String remoteRepoUrl,
String branchSpec)
getHeadRev.
|
Set<String> |
getRefNames(String refPrefix)
List refs with the given prefix.
|
Set<Branch> |
getRemoteBranches()
getRemoteBranches.
|
Map<String,ObjectId> |
getRemoteReferences(String url,
String pattern,
boolean headsOnly,
boolean tagsOnly)
List references in a remote repository.
|
Map<String,String> |
getRemoteSymbolicReferences(String url,
String pattern)
List symbolic references in a remote repository.
|
Set<String> |
getRemoteTagNames(String tagPattern)
getRemoteTagNames.
|
String |
getRemoteUrl(String name)
From a given repository, get a remote's URL
|
String |
getRemoteUrl(String name,
String GIT_DIR)
Deprecated.
|
Repository |
getRepository()
getRepository.
|
List<IndexEntry> |
getSubmodules(String treeIsh)
Finds all the submodule references in this repository at the specified tree.
|
String |
getSubmoduleUrl(String name)
Deprecated.
|
String |
getTagMessage(String tagName)
getTagMessage.
|
Set<String> |
getTagNames(String tagPattern)
getTagNames.
|
Set<GitObject> |
getTags()
Return name and object ID of all tags in current repository.
|
List<Tag> |
getTagsOnCommit(String revName)
Deprecated.
|
hudson.FilePath |
getWorkTree()
getWorkTree.
|
boolean |
hasGitModules()
hasGitModules.
|
boolean |
hasGitModules(String treeIsh)
Deprecated.
|
boolean |
hasGitRepo()
hasGitRepo.
|
InitCommand |
init_()
init_.
|
void |
init()
init.
|
boolean |
isBareRepository()
isBareRepository.
|
boolean |
isBareRepository(String GIT_DIR)
Deprecated.
|
boolean |
isCommitInRepo(ObjectId commit)
isCommitInRepo.
|
List<IndexEntry> |
lsTree(String treeIsh)
This method has been implemented as non-recursive historically, but
often that is not what the caller wants.
|
List<IndexEntry> |
lsTree(String treeIsh,
boolean recursive)
Deprecated.
|
MergeCommand |
merge()
merge.
|
void |
merge(ObjectId rev)
merge.
|
void |
merge(String refSpec)
Deprecated.
|
ObjectId |
mergeBase(ObjectId id1,
ObjectId id2)
Deprecated.
|
void |
prune(RemoteConfig repository)
Prune stale remote tracking branches with "git remote prune" on the specified remote.
|
PushCommand |
push()
push.
|
void |
push(RemoteConfig repository,
String refspec)
Deprecated.
|
void |
push(String remoteName,
String refspec)
Deprecated.
|
void |
push(URIish url,
String refspec)
Deprecated.
|
RebaseCommand |
rebase()
rebase.
|
void |
ref(String refName)
Create (or update) a ref.
|
boolean |
refExists(String refName)
Check if a ref exists.
|
protected org.jenkinsci.plugins.gitclient.RemoteGitImpl |
remoteProxyFor(GitClient proxy)
remoteProxyFor.
|
void |
reset()
Deprecated.
|
void |
reset(boolean hard)
Deprecated.
|
RevListCommand |
revList_()
revList_.
|
List<ObjectId> |
revList(String ref)
revList.
|
List<ObjectId> |
revListAll()
revListAll.
|
List<ObjectId> |
revListBranch(String branchId)
Deprecated.
|
ObjectId |
revParse(String revName)
Retrieve commit object that is direct child for
revName revision reference. |
void |
setAuthor(PersonIdent p)
setAuthor.
|
void |
setAuthor(String name,
String email)
Sets the identity of the author for future commits and merge operations.
|
void |
setCommitter(PersonIdent p)
setCommitter.
|
void |
setCommitter(String name,
String email)
Sets the identity of the committer for future commits and merge operations.
|
void |
setCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials cred)
setCredentials.
|
void |
setCredentialsProvider(CredentialsProvider prov)
setCredentialsProvider.
|
void |
setProxy(hudson.ProxyConfiguration proxy)
setProxy.
|
void |
setRemoteUrl(String name,
String url)
For a given repository, set a remote's URL
|
void |
setRemoteUrl(String name,
String url,
String GIT_DIR)
Deprecated.
|
void |
setSubmoduleUrl(String name,
String url)
Deprecated.
|
void |
setupSubmoduleUrls(Revision rev,
hudson.model.TaskListener listener)
Deprecated.
|
void |
setupSubmoduleUrls(String remote,
hudson.model.TaskListener listener)
Deprecated.
|
List<String> |
showRevision(ObjectId r)
Given a Revision, show it as if it were an entry from git whatchanged, so that it
can be parsed by GitChangeLogParser.
|
List<String> |
showRevision(ObjectId from,
ObjectId to)
Given a Revision, show it as if it were an entry from git whatchanged, so that it
can be parsed by GitChangeLogParser.
|
List<String> |
showRevision(ObjectId from,
ObjectId to,
Boolean useRawOutput)
Given a Revision, show it as if it were an entry from git whatchanged, so that it
can be parsed by GitChangeLogParser.
|
List<String> |
showRevision(Revision r)
Deprecated.
|
GitClient |
subGit(String subdir)
subGit.
|
void |
submoduleClean(boolean recursive)
submoduleClean.
|
void |
submoduleInit()
Deprecated.
|
void |
submoduleSync()
Deprecated.
|
SubmoduleUpdateCommand |
submoduleUpdate()
Update submodules.
|
void |
submoduleUpdate(boolean recursive)
Run submodule update optionally recursively on all submodules
(equivalent of
git submodule update --recursive.) |
void |
submoduleUpdate(boolean recursive,
boolean remoteTracking)
Run submodule update optionally recursively on all submodules, optionally with remoteTracking submodules
(equivalent of
git submodule update --recursive --remote.) |
void |
submoduleUpdate(boolean recursive,
boolean remoteTracking,
String reference)
Run submodule update optionally recursively on all submodules, optionally with remoteTracking, with a specific
reference passed to git clone if needing to --init.
|
void |
submoduleUpdate(boolean recursive,
String reference)
Run submodule update optionally recursively on all submodules, with a specific
reference passed to git clone if needing to --init.
|
void |
tag(String name,
String message)
Create (or update) a tag.
|
boolean |
tagExists(String tagName)
tagExists.
|
<T> T |
withRepository(RepositoryCallback<T> callable)
Runs the computation that requires local access to
Repository. |
protected Object |
writeReplace()
When sent to remote, switch to the proxy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitchangelog, checkoutBranchchangelog, checkout, checkout, clone, commit, merge, setAuthor, setCommitter, setCredentials, setProxy, submoduleUpdate, submoduleUpdate, submoduleUpdate, submoduleUpdate, withRepositoryprotected final File workspace
protected hudson.ProxyConfiguration proxy
public void clearCredentials()
public void addCredentials(String url, com.cloudbees.plugins.credentials.common.StandardCredentials credentials)
url - the url for the credentials to be used against.credentials - the credentials to use.public void addDefaultCredentials(com.cloudbees.plugins.credentials.common.StandardCredentials credentials)
credentials - the credentials to use.GitClient.addCredentials(String, com.cloudbees.plugins.credentials.common.StandardCredentials)public void setCredentialsProvider(CredentialsProvider prov)
prov - a CredentialsProvider object.public GitClient subGit(String subdir)
subdir - a String object.public void setAuthor(String name, String email) throws GitException
name - a String object.email - a String object.GitException - if underlying git operation fails.public void setCommitter(String name, String email) throws GitException
name - a String object.email - a String object.GitException - if underlying git operation fails.public void init()
throws GitException,
InterruptedException
GitException - if underlying git operation fails.InterruptedException - if interrupted.public CheckoutCommand checkout()
CheckoutCommand object.public void add(String filePattern) throws GitException
filePattern - a String object.GitException - if underlying git operation fails.public void commit(String message) throws GitException
message - a String object.GitException - if underlying git operation fails.public void branch(String name) throws GitException
name - a String object.GitException - if underlying git operation fails.public void deleteBranch(String name) throws GitException
name - a String object.GitException - if underlying git operation fails.public Set<Branch> getBranches() throws GitException
Set object.GitException - if underlying git operation fails.public Set<Branch> getRemoteBranches() throws GitException
Set object.GitException - if underlying git operation fails.public Set<Branch> getBranchesInternal(ListBranchCommand.ListMode mode) throws GitException
GitExceptionpublic void tag(String name, String message) throws GitException
git tag --force)name - a String object.message - a String object.GitException - if underlying git operation fails.public boolean tagExists(String tagName) throws GitException
tagName - a String object.GitException - if underlying git operation fails.public FetchCommand fetch_()
FetchCommand object.public void fetch(URIish url, List<RefSpec> refspecs) throws GitException, InterruptedException
remote.remoteName.url has been set.url - a URIish object.refspecs - a List object.GitException - if any.InterruptedException - if any.public void fetch(String remoteName, RefSpec... refspec) throws GitException
remoteName - a String object.refspec - a RefSpec object.GitException - if underlying git operation fails.public void fetch(String remoteName, RefSpec refspec) throws GitException
remoteName - a String object.refspec - a RefSpec object.GitException - if underlying git operation fails.public void ref(String refName) throws GitException, InterruptedException
git update-ref ... HEAD).refName - the full name of the ref (e.g. "refs/myref"). Spaces will be replaced with underscores.GitException - if underlying git operation fails.InterruptedException - if interrupted.public boolean refExists(String refName) throws GitException, InterruptedException
git show-ref to zero.refName - the full name of the ref (e.g. "refs/myref"). Spaces will be replaced with underscores.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void deleteRef(String refName) throws GitException, InterruptedException
git update-ref -d.refName - the full name of the ref (e.g. "refs/myref"). Spaces will be replaced with underscores.GitException - if underlying git operation fails.InterruptedException - if interrupted.public Set<String> getRefNames(String refPrefix) throws GitException, InterruptedException
git for-each-ref --format="%(refname)".refPrefix - the literal prefix any ref returned will have. The empty string implies all.GitException - if underlying git operation fails.InterruptedException - if interrupted.public Map<String,ObjectId> getHeadRev(String url) throws GitException, InterruptedException
url - a String object.Map object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public Map<String,ObjectId> getRemoteReferences(String url, String pattern, boolean headsOnly, boolean tagsOnly) throws GitException, InterruptedException
git ls-remote [--heads] [--tags] <repository> [<refs>].url - Remote repository URL.pattern - Only references matching the given pattern are displayed.headsOnly - Limit to only refs/heads.tagsOnly - Limit to only refs/tags.
headsOnly and tagsOnly are not mutually exclusive;
when both are true, references stored in refs/heads and refs/tags are displayed.GitException - if underlying git operation fails.InterruptedException - if interrupted.public Map<String,String> getRemoteSymbolicReferences(String url, String pattern) throws GitException, InterruptedException
GitClientgit ls-remote --symref <repository>
[<refs>]. Note: the response may be empty for multiple reasonsurl - Remote repository URL.pattern - Only references matching the given pattern are displayed.GitException - if underlying git operation fails.InterruptedException - if interrupted.public ObjectId getHeadRev(String remoteRepoUrl, String branchSpec) throws GitException
remoteRepoUrl - a String object.branchSpec - a String object.ObjectId object.GitException - if underlying git operation fails.public String getRemoteUrl(String name) throws GitException
name - The name of the remote (e.g. origin)String object.GitException - if executing the git command fails@NonNull public Repository getRepository() throws GitException
Repository object.GitException - if underlying git operation fails.public hudson.FilePath getWorkTree()
FilePath object.public void 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 failspublic void addRemoteUrl(String name, String url) throws GitException, InterruptedException
name - a String object.url - a String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void addNote(String note, String namespace) throws GitException
note - Content of the note.namespace - If unqualified, interpreted as "refs/notes/NAMESPACE" just like cgit.GitException - if underlying git operation fails.public void appendNote(String note, String namespace) throws GitException
GitClient.addNote(String, String)note - Content of the note.namespace - If unqualified, interpreted as "refs/notes/NAMESPACE" just like cgit.GitException - if underlying git operation fails.public ChangelogCommand changelog()
ChangelogCommand object.public void clean(boolean cleanSubmodule)
throws GitException
cleanSubmodule - flag to add extra -fGitException - if underlying git operation fails.public void clean()
throws GitException
GitException - if underlying git operation fails.public CloneCommand clone_()
CloneCommand object.public MergeCommand merge()
MergeCommand object.public InitCommand init_()
InitCommand object.public RebaseCommand rebase()
GitClientRebaseCommand object.public void deleteTag(String tagName) throws GitException
tagName - a String object.GitException - if underlying git operation fails.public String getTagMessage(String tagName) throws GitException
tagName - a String object.String object.GitException - if underlying git operation fails.public List<IndexEntry> getSubmodules(String treeIsh) throws GitException
treeIsh - a String object.GitException - if underlying git operation fails.public void addSubmodule(String remoteURL, String subdir) throws GitException
remoteURL - a String object.subdir - a String object.GitException - if underlying git operation fails.public Set<String> getTagNames(String tagPattern) throws GitException
tagPattern - a String object.Set object.GitException - if underlying git operation fails.public Set<String> getRemoteTagNames(String tagPattern) throws GitException
tagPattern - a String object.Set object.GitException - if underlying git operation fails.public boolean hasGitRepo()
throws GitException
GitException - if underlying git operation fails.public boolean isCommitInRepo(ObjectId commit) throws GitException
commit - a ObjectId object.GitException - if underlying git operation fails.public void prune(RemoteConfig repository) throws GitException
repository - a RemoteConfig object.GitException - if underlying git operation fails.public PushCommand push()
PushCommand object.public RevListCommand revList_()
RevListCommand object.public List<ObjectId> revListAll() throws GitException
List object.GitException - if underlying git operation fails.public List<ObjectId> revList(String ref) throws GitException
ref - a String object.List object.GitException - if underlying git operation fails.public ObjectId revParse(String revName) throws GitException
revName revision reference.revName - a commit sha1 or tag/branch refnameObjectId object.GitException - when no such commit / revName is found in repository.public List<String> showRevision(ObjectId from, ObjectId to) throws GitException
Changes are computed on the [from..to] range. If from is null, this prints
just one commit that to represents.
For merge commit, this method reports one diff per each parent. This makes this method
behave differently from GitClient.changelog().
from - a ObjectId object.to - a ObjectId object.raw format.GitException - if underlying git operation fails.public List<String> showRevision(ObjectId from, ObjectId to, Boolean useRawOutput) throws GitException
If useRawOutput is true, the '--raw' option will include commit file information to be passed to the GitChangeLogParser.
Changes are computed on the [from..to] range. If from is null, this prints
just one commit that to represents.
For merge commit, this method reports one diff per each parent. This makes this method
behave differently from GitClient.changelog().
from - a ObjectId object.to - a ObjectId object.useRawOutput - a {java.lang.Boolean} object.raw format.GitException - if underlying git operation fails.public void submoduleClean(boolean recursive)
throws GitException
recursive - a boolean.GitException - if underlying git operation fails.public SubmoduleUpdateCommand submoduleUpdate()
SubmoduleUpdateCommand object.@Deprecated public void merge(String refSpec) throws GitException, InterruptedException
refSpec - the revision specification to be merged (for example, origin/master)GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void push(RemoteConfig repository, String refspec) throws GitException, InterruptedException
repository - git repository to receive commitsrefspec - commits to be pushedGitException - if underlying git operating failsInterruptedException - if interruptedpublic List<Branch> getBranchesContaining(String revspec) throws GitException, InterruptedException
revspec - substring to be searched for branch nameGitException - on failureInterruptedException - if interruptedpublic List<Branch> getBranchesContaining(String revspec, boolean allBranches) throws GitException, InterruptedException
Since we reuse RevWalk, it'd be nice to flag commits reachable from 't' as uninteresting
and keep them across resets, but I'm not sure how to do it.
revspec - commit id to query forallBranches - whether remote branches should be also queried (true) or not (false)GitException - on Git exceptionsInterruptedException - on thread interruption@Deprecated public ObjectId mergeBase(ObjectId id1, ObjectId id2) throws InterruptedException
id1 - a ObjectId object.id2 - a ObjectId object.ObjectId object.InterruptedException - if interrupted.@Deprecated public String getAllLogEntries(String branch) throws InterruptedException
branch - a String object.String object.InterruptedException - if interrupted.@Deprecated public void submoduleInit() throws GitException, InterruptedException
GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void submoduleSync() throws GitException, InterruptedException
GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public String getSubmoduleUrl(String name) throws GitException, InterruptedException
name - submodule name whose URL will be returnedGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void setSubmoduleUrl(String name, String url) throws GitException, InterruptedException
name - submodule name whose URL will be seturl - URL for the named submoduleGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void setupSubmoduleUrls(Revision rev, hudson.model.TaskListener listener) throws GitException
rev - a Revision object.listener - a TaskListener object.GitException - if underlying git operation fails.@Deprecated public void fixSubmoduleUrls(String remote, hudson.model.TaskListener listener) throws GitException, InterruptedException
remote - a String object.listener - a TaskListener object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public String describe(String tip) throws GitException, InterruptedException
The basic structure of the algorithm is as follows. We walk the commit graph, find tags, and mark commits that are reachable from those tags. The marking uses flags given by JGit, so there's a fairly small upper bound in the number of tags we can keep track of.
As we walk commits, we count commits that each tag doesn't contain. We call it "depth", following the variable name in C Git. As we walk further and find enough tags, we go into wind-down mode and only walk to the point of accurately determining all the depths.
tip - a String object.String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public List<IndexEntry> lsTree(String treeIsh, boolean recursive) throws GitException, InterruptedException
treeIsh - a String object.recursive - a boolean.List object.GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void reset(boolean hard) throws GitException, InterruptedException
hard - reset as though "--hard" were passed to "git reset"GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public boolean isBareRepository(String GIT_DIR) throws GitException, InterruptedException
GIT_DIR - The path to the repository (must be to .git dir).GitException - on failureInterruptedException - if interrupted@Deprecated public String getDefaultRemote(String _default_) throws GitException, InterruptedException
_default_ - value to return if no remote is defined in this repositoryGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void setRemoteUrl(String name, String url, String GIT_DIR) throws GitException, InterruptedException
name - name for the remote repository, for examnple, "origin"url - URL for the remote repository, for example git://github.com/jenkinsci/git-client-plugin.gitGIT_DIR - directory containing git repositoryGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public String getRemoteUrl(String name, String GIT_DIR) throws GitException, InterruptedException
name - name for the remote repository, for examnple, "origin"GIT_DIR - directory containing git repositoryGitException - if underlying git operation fails.InterruptedException - if interrupted.public Set<GitObject> getTags() throws GitException, InterruptedException
GitException - on Git exceptionsInterruptedException - on thread interruptionpublic boolean isBareRepository()
throws GitException,
InterruptedException
isBareRepository in interface IGitAPIGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public boolean hasGitModules(String treeIsh) throws GitException
hasGitModules in interface IGitAPItreeIsh - an ignored argument, kept for compatibilityGitException - if underlying git operation fails.GitClient.hasGitModules()@Deprecated public void setupSubmoduleUrls(String remote, hudson.model.TaskListener listener) throws GitException, InterruptedException
setupSubmoduleUrls in interface IGitAPIGitExceptionInterruptedException@Deprecated public void fetch(String repository, String refspec) throws GitException, InterruptedException
fetch in interface IGitAPIrepository - URL of the repository to be retrievedrefspec - definition of mapping from remote refs to local refsGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void fetch(RemoteConfig remoteRepository) throws InterruptedException
fetch in interface IGitAPIremoteRepository - remote configuration from which refs will be retrievedInterruptedException - if interrupted.@Deprecated public void fetch() throws GitException, InterruptedException
fetch in interface IGitAPIGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void reset() throws GitException, InterruptedException
reset in interface IGitAPIGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void push(URIish url, String refspec) throws GitException, InterruptedException
push in interface GitClienturl - a URIish object.refspec - a String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void push(String remoteName, String refspec) throws GitException, InterruptedException
push in interface GitClientremoteName - a String object.refspec - a String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void clone(RemoteConfig source) throws GitException, InterruptedException
clone in interface IGitAPIsource - remote repository to be clonedGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public void clone(RemoteConfig rc, boolean useShallowClone) throws GitException, InterruptedException
RemoteConfig rc to this repository.clone in interface IGitAPIrc - the remote config for the remote repositoryuseShallowClone - if true, use a shallow cloneGitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public List<ObjectId> revListBranch(String branchId) throws GitException, InterruptedException
revListBranch in interface IGitAPIbranchId - a String object.List object.GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public List<String> showRevision(Revision r) throws GitException, InterruptedException
showRevision in interface IGitAPIr - a Revision object.List object.GitException - if underlying git operation fails.InterruptedException - if interrupted.@Deprecated public List<Tag> getTagsOnCommit(String revName) throws GitException, IOException
getTagsOnCommit in interface IGitAPIrevName - a String object.List object.GitException - if underlying git operation fails.IOException - if any IO failurepublic final List<IndexEntry> lsTree(String treeIsh) throws GitException, InterruptedException
lsTree in interface IGitAPItreeIsh - string representation of a treeIsh itemGitException - on failureInterruptedException - if interruptedprotected Object writeReplace() throws ObjectStreamException
Object object.ObjectStreamException - if current channel is nullpublic boolean hasGitModules()
throws GitException
hasGitModules in interface GitClientGitException - if underlying git operation fails.public List<String> showRevision(ObjectId r) throws GitException, InterruptedException
Changes are computed on the [from..to] range. If from is null, this prints
just one commit that to represents.
For merge commit, this method reports one diff per each parent. This makes this method
behave differently from GitClient.changelog().
showRevision in interface GitClientr - a ObjectId object.raw format.GitException - if underlying git operation fails.InterruptedException - if interrupted.protected String extractBranchNameFromBranchSpec(String branchSpec)
| branch spec | normalized | |
|---|---|---|
master | master* | |
feature1 | feature1* | |
feature1/master | master feature1/master* | |
origin/master | master* | |
repo2/feature1 | feature1* | |
refs/heads/feature1 | refs/heads/feature1 | |
| origin/namespaceA/fix15 | fix15 namespaceA/fix15* | |
refs/heads/namespaceA/fix15 | refs/heads/namespaceA/fix15 | |
remotes/origin/namespaceA/fix15 | refs/heads/namespaceA/fix15 |
branchSpec - a String object.public <T> T withRepository(RepositoryCallback<T> callable) throws IOException, InterruptedException
Repository.withRepository in interface GitClientT - type for the repository callbackcallable - the repository callback used as closure to instanceIOException - in case of IO errorInterruptedException - if interruptedpublic void commit(String message, PersonIdent author, PersonIdent committer) throws GitException, InterruptedException
commit in interface GitClientmessage - a String object.author - a PersonIdent object.committer - a PersonIdent object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void setAuthor(PersonIdent p)
setAuthor in interface GitClientp - a PersonIdent object.public void setCommitter(PersonIdent p)
setCommitter in interface GitClientp - a PersonIdent object.public void changelog(String revFrom, String revTo, OutputStream outputStream) throws GitException, InterruptedException
changelog in interface GitClientrevFrom - a String object.revTo - a String object.outputStream - a OutputStream object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void changelog(String revFrom, String revTo, Writer w) throws GitException, InterruptedException
GitClient.changelog() with appropriate parameters.changelog in interface GitClientrevFrom - a String object.revTo - a String object.w - a Writer object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void clone(String url, String origin, boolean useShallowClone, String reference) throws GitException, InterruptedException
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 - if underlying git operation fails.InterruptedException - if interrupted.public void checkout(String commit) throws GitException, InterruptedException
git checkout branch.)checkout in interface GitClientcommit - A git object references expression (either a sha1, tag or branch)GitException - if underlying git operation fails.InterruptedException - if interrupted.public void checkout(String ref, String branch) throws GitException, InterruptedException
checkout in interface GitClientref - A git object references expression. For backward compatibility, null will checkout current HEADbranch - name of the branch to create from referenceGitException - if underlying git operation fails.InterruptedException - if interrupted.public void checkoutBranch(String branch, String ref) throws GitException, InterruptedException
HEAD points to branch. In other words, the workspace is on the specified branch.
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 GitClientbranch - a String object.ref - a String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void merge(ObjectId rev) throws GitException, InterruptedException
merge in interface GitClientrev - a ObjectId object.GitException - if underlying git operation fails.InterruptedException - if interrupted.protected org.jenkinsci.plugins.gitclient.RemoteGitImpl remoteProxyFor(GitClient proxy)
proxy - a GitClient object.RemoteGitImpl object.public void setCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials cred)
setCredentials in interface GitClientcred - a StandardUsernameCredentials object.public void setProxy(hudson.ProxyConfiguration proxy)
public void submoduleUpdate(boolean recursive)
throws GitException,
InterruptedException
git submodule update --recursive.)submoduleUpdate in interface GitClientrecursive - a boolean.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void submoduleUpdate(boolean recursive,
String reference)
throws GitException,
InterruptedException
git submodule update --recursive --reference 'reference'.)submoduleUpdate in interface GitClientrecursive - a boolean.reference - a String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void submoduleUpdate(boolean recursive,
boolean remoteTracking)
throws GitException,
InterruptedException
git submodule update --recursive --remote.)submoduleUpdate in interface GitClientrecursive - a boolean.remoteTracking - a boolean.GitException - if underlying git operation fails.InterruptedException - if interrupted.public void submoduleUpdate(boolean recursive,
boolean remoteTracking,
String reference)
throws GitException,
InterruptedException
git submodule update --recursive --remote --reference 'reference'.)submoduleUpdate in interface GitClientrecursive - a boolean.remoteTracking - a boolean.reference - a String object.GitException - if underlying git operation fails.InterruptedException - if interrupted.Copyright © 2013–2020. All rights reserved.