Class RepoCommand
- Since:
- 3.4
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A default implementation ofRepoCommand.RemoteReader
callback.private static class
static final class
Read-only view of contents and file mode (i.e.static interface
A callback to get ref sha1 of a repository from its uri.private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PersonIdent
private String
private String
private RepoCommand.RemoteReader
private String
private boolean
private InputStream
private String
private ProgressMonitor
private boolean
private boolean
private boolean
private static final String
private String
private URI
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addSubmodule
(String name, String url, String path, String revision, List<RepoProject.CopyFile> copyfiles, List<RepoProject.LinkFile> linkfiles, Git git) call()
private static String
findRef
(String ref, Repository repo) (package private) static URI
relativize
(URI current, URI target) private List
<RepoProject> renameProjects
(List<RepoProject> projects) Rename the projects if there's a conflict when converted to submodules.setAuthor
(PersonIdent author) Set the author/committer for the bare repository commit.Set default branch.Set groups to syncsetIgnoreRemoteFailures
(boolean ignore) Set whether to skip projects whose commits don't exist remotely.Set the IncludedFileReader callback.setInputStream
(InputStream inputStream) Set the input stream to the manifest XML.Set path to the manifest XML file.setProgressMonitor
(ProgressMonitor monitor) The progress monitor associated with the clone operation.setRecommendShallow
(boolean enable) Set whether the clone-depth field should be recorded as a shallow recommendation in .gitmodules.setRecordRemoteBranch
(boolean enable) Set whether the branch name should be recorded in .gitmodules.setRecordSubmoduleLabels
(boolean enable) Set whether the labels field should be recorded as a label in .gitattributes.setRemoteReader
(RepoCommand.RemoteReader callback) Set the GetHeadFromUri callback.setTargetBranch
(String branch) Set target branch.setTargetURI
(String uri) Set the URI of the superproject (this repository), so the .gitmodules file can specify the submodule URLs relative to the superproject.Set base URI of the paths inside the XML.Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
manifestPath
-
baseUri
-
targetUri
-
groupsParam
-
branch
-
targetBranch
-
recordRemoteBranch
private boolean recordRemoteBranch -
recordSubmoduleLabels
private boolean recordSubmoduleLabels -
recordShallowSubmodules
private boolean recordShallowSubmodules -
author
-
callback
-
inputStream
-
includedReader
-
ignoreRemoteFailures
private boolean ignoreRemoteFailures -
monitor
-
SLASH
- See Also:
-
-
Constructor Details
-
RepoCommand
Constructor for RepoCommand- Parameters:
repo
- theRepository
-
-
Method Details
-
setPath
Set path to the manifest XML file.Calling
setInputStream(java.io.InputStream)
will ignore the path set here.- Parameters:
path
- (with/
as separator)- Returns:
- this command
-
setInputStream
Set the input stream to the manifest XML.Setting inputStream will ignore the path set. It will be closed in
call()
.- Parameters:
inputStream
- aInputStream
object.- Returns:
- this command
- Since:
- 3.5
-
setURI
Set base URI of the paths inside the XML. This is typically the name of the directory holding the manifest repository, eg. for https://android.googlesource.com/platform/manifest, this should be /platform (if you would run this on android.googlesource.com) or https://android.googlesource.com/platform elsewhere.- Parameters:
uri
- the base URI- Returns:
- this command
-
setTargetURI
Set the URI of the superproject (this repository), so the .gitmodules file can specify the submodule URLs relative to the superproject.- Parameters:
uri
- the URI of the repository holding the superproject.- Returns:
- this command
- Since:
- 4.8
-
setGroups
Set groups to sync- Parameters:
groups
- groups separated by comma, examples: default|all|G1,-G2,-G3- Returns:
- this command
-
setBranch
Set default branch.This is generally the name of the branch the manifest file was in. If there's no default revision (branch) specified in manifest and no revision specified in project, this branch will be used.
- Parameters:
branch
- a branch name- Returns:
- this command
-
setTargetBranch
Set target branch.This is the target branch of the super project to be updated. If not set, default is HEAD.
For non-bare repositories, HEAD will always be used and this will be ignored.
- Parameters:
branch
- branch name- Returns:
- this command
- Since:
- 4.1
-
setRecordRemoteBranch
Set whether the branch name should be recorded in .gitmodules.Submodule entries in .gitmodules can include a "branch" field to indicate what remote branch each submodule tracks.
That field is used by "git submodule update --remote" to update to the tip of the tracked branch when asked and by Gerrit to update the superproject when a change on that branch is merged.
Subprojects that request a specific commit or tag will not have a branch name recorded.
Not implemented for non-bare repositories.
- Parameters:
enable
- Whether to record the branch name- Returns:
- this command
- Since:
- 4.2
-
setRecordSubmoduleLabels
Set whether the labels field should be recorded as a label in .gitattributes.Not implemented for non-bare repositories.
- Parameters:
enable
- Whether to record the labels in the .gitattributes- Returns:
- this command
- Since:
- 4.4
-
setRecommendShallow
Set whether the clone-depth field should be recorded as a shallow recommendation in .gitmodules.Not implemented for non-bare repositories.
- Parameters:
enable
- Whether to record the shallow recommendation.- Returns:
- this command
- Since:
- 4.4
-
setProgressMonitor
The progress monitor associated with the clone operation. By default, this is set toNullProgressMonitor
- Parameters:
monitor
- aProgressMonitor
- Returns:
- this command
- See Also:
-
setIgnoreRemoteFailures
Set whether to skip projects whose commits don't exist remotely.When set to true, we'll just skip the manifest entry and continue on to the next one.
When set to false (default), we'll throw an error when remote failures occur.
Not implemented for non-bare repositories.
- Parameters:
ignore
- Whether to ignore the remote failures.- Returns:
- this command
- Since:
- 4.3
-
setAuthor
Set the author/committer for the bare repository commit.For non-bare repositories, the current user will be used and this will be ignored.
- Parameters:
author
- the author'sPersonIdent
- Returns:
- this command
-
setRemoteReader
Set the GetHeadFromUri callback. This is only used in bare repositories.- Parameters:
callback
- aRepoCommand.RemoteReader
object.- Returns:
- this command
-
setIncludedFileReader
Set the IncludedFileReader callback.- Parameters:
reader
- aManifestParser.IncludedFileReader
object.- Returns:
- this command
- Since:
- 4.0
-
call
Execute the command
- Specified by:
call
in interfaceCallable<RevCommit>
- Specified by:
call
in classGitCommand<RevCommit>
- Throws:
GitAPIException
-
addSubmodule
private void addSubmodule(String name, String url, String path, String revision, List<RepoProject.CopyFile> copyfiles, List<RepoProject.LinkFile> linkfiles, Git git) throws GitAPIException, IOException - Throws:
GitAPIException
IOException
-
renameProjects
Rename the projects if there's a conflict when converted to submodules.- Parameters:
projects
- parsed projects- Returns:
- projects that are renamed if necessary
-
relativize
-
findRef
- Throws:
IOException
-