org.eclipse.jgit.api
Class CloneCommand

java.lang.Object
  extended by org.eclipse.jgit.api.CloneCommand
All Implemented Interfaces:
Callable<Git>

public class CloneCommand
extends Object
implements Callable<Git>

Clone a repository into a new working directory

See Also:
Git documentation about Clone

Constructor Summary
CloneCommand()
           
 
Method Summary
 Git call()
          Executes the Clone command.
 CloneCommand setBare(boolean bare)
           
 CloneCommand setBranch(String branch)
           
 CloneCommand setBranchesToClone(Collection<String> branchesToClone)
           
 CloneCommand setCloneAllBranches(boolean cloneAllBranches)
           
 CloneCommand setCredentialsProvider(CredentialsProvider credentialsProvider)
           
 CloneCommand setDirectory(File directory)
          The optional directory associated with the clone operation.
 CloneCommand setNoCheckout(boolean noCheckout)
           
 CloneCommand setProgressMonitor(ProgressMonitor monitor)
          The progress monitor associated with the clone operation.
 CloneCommand setRemote(String remote)
          The remote name used to keep track of the upstream repository for the clone operation.
 CloneCommand setTimeout(int timeout)
           
 CloneCommand setURI(String uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloneCommand

public CloneCommand()
Method Detail

call

public Git call()
         throws JGitInternalException
Executes the Clone command.

Specified by:
call in interface Callable<Git>
Returns:
the newly created Git object with associated repository
Throws:
JGitInternalException - if the repository can't be created

setURI

public CloneCommand setURI(String uri)
Parameters:
uri - the uri to clone from
Returns:
this instance

setDirectory

public CloneCommand setDirectory(File directory)
The optional directory associated with the clone operation. If the directory isn't set, a name associated with the source uri will be used.

Parameters:
directory - the directory to clone to
Returns:
this instance
See Also:
URIish.getHumanishName()

setBare

public CloneCommand setBare(boolean bare)
Parameters:
bare - whether the cloned repository is bare or not
Returns:
this instance

setRemote

public CloneCommand setRemote(String remote)
The remote name used to keep track of the upstream repository for the clone operation. If no remote name is set, the default value of Constants.DEFAULT_REMOTE_NAME will be used.

Parameters:
remote - name that keeps track of the upstream repository
Returns:
this instance
See Also:
Constants.DEFAULT_REMOTE_NAME

setBranch

public CloneCommand setBranch(String branch)
Parameters:
branch - the initial branch to check out when cloning the repository
Returns:
this instance

setProgressMonitor

public CloneCommand setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the clone operation. By default, this is set to NullProgressMonitor

Parameters:
monitor -
Returns:
this
See Also:
NullProgressMonitor

setCredentialsProvider

public CloneCommand setCredentialsProvider(CredentialsProvider credentialsProvider)
Parameters:
credentialsProvider - the CredentialsProvider to use
Returns:
this

setTimeout

public CloneCommand setTimeout(int timeout)
Parameters:
timeout - the timeout used for the fetch step
Returns:
this

setCloneAllBranches

public CloneCommand setCloneAllBranches(boolean cloneAllBranches)
Parameters:
cloneAllBranches - true when all branches have to be fetched (indicates wildcard in created fetch refspec), false otherwise.
Returns:
this

setBranchesToClone

public CloneCommand setBranchesToClone(Collection<String> branchesToClone)
Parameters:
branchesToClone - collection of branches to clone. Ignored when allSelected is true.
Returns:
this

setNoCheckout

public CloneCommand setNoCheckout(boolean noCheckout)
Parameters:
noCheckout - if set to true no branch will be checked out after the clone. This enhances performance of the clone command when there is no need for a checked out branch.
Returns:
this


Copyright © 2011. All Rights Reserved.