Package org.eclipse.jgit.gitrepo

## Class RepoCommand

- java.lang.Object
- - org.eclipse.jgit.api.GitCommand<RevCommit>
  - - org.eclipse.jgit.gitrepo.RepoCommand

All Implemented Interfaces:
  `Callable<RevCommit>`

    public class RepoCommand
    extends GitCommand<RevCommit>

A class used to execute a repo command. This will parse a repo XML manifest, convert it into .gitmodules file and the repository config file. If called against a bare repository, it will replace all the existing content of the repository with the contents populated from the manifest. repo manifest allows projects overlapping, e.g. one project's path is "foo" and another project's path is "foo/bar". This won't work in git submodule, so we'll skip all the sub projects ("foo/bar" in the example) while converting.

Since:
  3.4
See Also:
  git-repo project page

### Nested Class Summary

Nested Classes
`static class` `RepoCommand.DefaultRemoteReader` A default implementation of `RepoCommand.RemoteReader` callback.
`static interface` `RepoCommand.IncludedFileReader` A callback to read included xml files.
`static interface` `RepoCommand.RemoteReader` A callback to get ref sha1 of a repository from its uri.

### Field Summary

### Fields inherited from class org.eclipse.jgit.api.GitCommand

`repo`

### Constructor Summary

Constructors
`RepoCommand​(Repository repo)`

### Method Summary

All Methods Instance Methods Concrete Methods
`RevCommit` `call()` Executes the command
`RepoCommand` `setAuthor​(PersonIdent author)` Set the author/committer for the bare repository commit.
`RepoCommand` `setBranch​(String branch)` Set default branch.
`RepoCommand` `setGroups​(String groups)` Set groups to sync
`RepoCommand` `setIncludedFileReader​(RepoCommand.IncludedFileReader reader)` Set the IncludedFileReader callback.
`RepoCommand` `setInputStream​(InputStream inputStream)` Set the input stream to the manifest XML.
`RepoCommand` `setPath​(String path)` Set path to the manifest XML file.
`RepoCommand` `setProgressMonitor​(ProgressMonitor monitor)` The progress monitor associated with the clone operation.
`RepoCommand` `setRemoteReader​(RepoCommand.RemoteReader callback)` Set the GetHeadFromUri callback.
`RepoCommand` `setURI​(String uri)` Set base URI of the pathes inside the XML

### Methods inherited from class org.eclipse.jgit.api.GitCommand

`checkCallable, getRepository, setCallable`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### RepoCommand

    public RepoCommand​(Repository repo)

Parameters:
  `repo` -

### Method Detail

#### setPath

    public RepoCommand setPath​(String path)

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

    public RepoCommand setInputStream​(InputStream inputStream)

Set the input stream to the manifest XML. Setting inputStream will ignore the path set. It will be closed in `call()`.

Parameters:
  `inputStream` -
Returns:
  this command
Since:
  3.5

#### setURI

    public RepoCommand setURI​(String uri)

Set base URI of the pathes inside the XML

Parameters:
  `uri` -
Returns:
  this command

#### setGroups

    public RepoCommand setGroups​(String groups)

Set groups to sync

Parameters:
  `groups` - groups separated by comma, examples: default|all|G1,-G2,-G3
Returns:
  this command

#### setBranch

    public RepoCommand setBranch​(String branch)

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` -
Returns:
  this command

#### setProgressMonitor

    public RepoCommand setProgressMonitor​(ProgressMonitor monitor)

The progress monitor associated with the clone operation. By default, this is set to `NullProgressMonitor`

Parameters:
  `monitor` -
Returns:
  this command
See Also:
  `NullProgressMonitor`

#### setAuthor

    public RepoCommand setAuthor​(PersonIdent author)

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` -
Returns:
  this command

#### setRemoteReader

    public RepoCommand setRemoteReader​(RepoCommand.RemoteReader callback)

Set the GetHeadFromUri callback. This is only used in bare repositories.

Parameters:
  `callback` -
Returns:
  this command

#### setIncludedFileReader

    public RepoCommand setIncludedFileReader​(RepoCommand.IncludedFileReader reader)

Set the IncludedFileReader callback.

Parameters:
  `reader` -
Returns:
  this command
Since:
  3.5

#### call

    public RevCommit call()
                   throws GitAPIException

Description copied from class: `GitCommand`
Executes the command

Specified by:
  `call` in interface `Callable<RevCommit>`
Specified by:
  `call` in class `GitCommand<RevCommit>`
Returns:
  T a result. Each command has its own return type
Throws:
  `GitAPIException` - or subclass thereof when an error occurs