Top Description Fields Constructors Methods
org.eclipse.jgit.transport

public Class RemoteConfig

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.net.URISyntaxException, java.util.ArrayList, .Collections, .List, org.eclipse.jgit.lib.Config

A remembered remote repository, including URLs and RefSpecs.

A remote configuration remembers one or more URLs for a frequently accessed remote repository as well as zero or more fetch and push specifications describing how refs should be transferred between this repository and the remote repository.

Field Summary

Modifier and TypeField and Description
private static final boolean
public static final String
DEFAULT_RECEIVE_PACK

Default value for getReceivePack() if not specified.

public static final String
DEFAULT_UPLOAD_PACK

Default value for getUploadPack() if not specified.

private List<RefSpec>
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private boolean
private String
private List<RefSpec>
private List<URIish>
private String
private static final String
private static final long
private TagOpt
private int
private String
private List<URIish>

Constructor Summary

AccessConstructor and Description
public
RemoteConfig(Config
the existing configuration to get the remote settings from. The configuration must already be loaded into memory.
rc
,
String
subsection key indicating the name of this remote.
remoteName
)

Parse a remote block from an existing configuration file.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the specification was added; false if it already exists.
addFetchRefSpec
(RefSpec
the new specification to add.
s
)

Add a new fetch RefSpec to this remote.

public boolean

Returns:

true if the specification was added; false if it already exists.
addPushRefSpec
(RefSpec
the new specification to add.
s
)

Add a new push RefSpec to this remote.

public boolean

Returns:

true if the URI was added; false if it already exists.
addPushURI
(URIish
the new URI to add to this remote.
toAdd
)

Add a new push-only URI to the end of the list of URIs.

public boolean

Returns:

true if the URI was added; false if it already exists.
addURI
(URIish
the new URI to add to this remote.
toAdd
)

Add a new URI to the end of the list of URIs.

public static List<RemoteConfig>

Returns:

all remotes configurations existing in provided repository configuration. Returned configurations are ordered lexicographically by names.
getAllRemoteConfigs
(Config
the existing configuration to get the remote settings from. The configuration must already be loaded into memory.
rc
)

Parse all remote blocks in an existing configuration file, looking for remotes configuration.

public List<RefSpec>

Returns:

set of specs used by default when fetching.
getFetchRefSpecs
()

Remembered specifications for fetching from a repository.

public String

Returns:

name assigned by the user to this configuration block.
getName
()

Get the local name this remote configuration is recognized as.

public List<RefSpec>

Returns:

set of specs used by default when pushing.
getPushRefSpecs
()

Remembered specifications for pushing to a repository.

public List<URIish>

Returns:

the set of URIs known to this remote.
getPushURIs
()

Get all configured push-only URIs under this remote.

public String

Returns:

location of 'git-receive-pack' on the remote system. If no location has been configured the default of 'git-receive-pack' is returned instead.
getReceivePack
()

Override for the location of 'git-receive-pack' on the remote system.

public TagOpt

Returns:

option indicating the behavior of annotated tags in fetch.
getTagOpt
()

Get the description of how annotated tags should be treated during fetch.

public int

Returns:

timeout (in seconds) before aborting an IO operation.
getTimeout
()

Get timeout (in seconds) before aborting an IO operation.

public String

Returns:

location of 'git-upload-pack' on the remote system. If no location has been configured the default of 'git-upload-pack' is returned instead.
getUploadPack
()

Override for the location of 'git-upload-pack' on the remote system.

public List<URIish>

Returns:

the set of URIs known to this remote.
getURIs
()

Get all configured URIs under this remote.

public boolean

Returns:

true if pushing to the remote automatically deletes remote refs which don't exist on the source side.
isMirror
()

Whether pushing to the remote automatically deletes remote refs which don't exist on the source side.

public boolean

Returns:

true if the specification existed and was removed.
removeFetchRefSpec
(RefSpec
the specification to remove.
s
)

Remove a fetch RefSpec from this remote.

public boolean

Returns:

true if the specification existed and was removed.
removePushRefSpec
(RefSpec
the specification to remove.
s
)

Remove a push RefSpec from this remote.

public boolean

Returns:

true if the URI was added; false if it already exists.
removePushURI
(URIish
the URI to remove from this remote.
toRemove
)

Remove a push-only URI from the list of URIs.

public boolean

Returns:

true if the URI was added; false if it already exists.
removeURI
(URIish
the URI to remove from this remote.
toRemove
)

Remove a URI from the list of URIs.

private void
set(final Config rc, final String key, final String currentValue, final String defaultValue)

private void
set(final Config rc, final String key, final boolean currentValue, final boolean defaultValue)

private void
set(final Config rc, final String key, final int currentValue, final int defaultValue)

public void
setFetchRefSpecs(List<RefSpec>
list of fetch specifications to set. List is copied, it can be modified after this call.
specs
)

Override existing fetch specifications with new ones.

public void
setMirror(boolean
true to automatically delete remote refs during push.
m
)

Set the mirror flag to automatically delete remote refs.

public void
setPushRefSpecs(List<RefSpec>
list of push specifications to set. List is copied, it can be modified after this call.
specs
)

Override existing push specifications with new ones.

public void
setTagOpt(TagOpt
method to use when handling annotated tags.
option
)

Set the description of how annotated tags should be treated on fetch.

public void
setTimeout(int
number of seconds to wait (with no data transfer occurring) before aborting an IO read or write operation with this remote. A timeout of 0 will block indefinitely.
seconds
)

Set the timeout before willing to abort an IO call.

private void
unset(Config rc, String key)

public void
update(Config
the configuration file to store ourselves into.
rc
)

Update this remote's definition within the configuration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_MIRRORback to summary
private static final boolean DEFAULT_MIRROR
DEFAULT_RECEIVE_PACKback to summary
public static final String DEFAULT_RECEIVE_PACK

Default value for getReceivePack() if not specified.

DEFAULT_UPLOAD_PACKback to summary
public static final String DEFAULT_UPLOAD_PACK

Default value for getUploadPack() if not specified.

fetchback to summary
private List<RefSpec> fetch
KEY_FETCHback to summary
private static final String KEY_FETCH
KEY_MIRRORback to summary
private static final String KEY_MIRROR
KEY_PUSHback to summary
private static final String KEY_PUSH
KEY_PUSHURLback to summary
private static final String KEY_PUSHURL
KEY_RECEIVEPACKback to summary
private static final String KEY_RECEIVEPACK
KEY_TAGOPTback to summary
private static final String KEY_TAGOPT
KEY_TIMEOUTback to summary
private static final String KEY_TIMEOUT
KEY_UPLOADPACKback to summary
private static final String KEY_UPLOADPACK
KEY_URLback to summary
private static final String KEY_URL
mirrorback to summary
private boolean mirror
nameback to summary
private String name
pushback to summary
private List<RefSpec> push
pushURIsback to summary
private List<URIish> pushURIs
receivepackback to summary
private String receivepack
SECTIONback to summary
private static final String SECTION
serialVersionUIDback to summary
private static final long serialVersionUID
tagoptback to summary
private TagOpt tagopt
timeoutback to summary
private int timeout
uploadpackback to summary
private String uploadpack
urisback to summary
private List<URIish> uris

Constructor Detail

RemoteConfigback to summary
public RemoteConfig(Config rc, String remoteName) throws URISyntaxException

Parse a remote block from an existing configuration file.

This constructor succeeds even if the requested remote is not defined within the supplied configuration file. If that occurs then there will be no URIs and no ref specifications known to the new instance.

Parameters
rc:Config

the existing configuration to get the remote settings from. The configuration must already be loaded into memory.

remoteName:String

subsection key indicating the name of this remote.

Exceptions
URISyntaxException:
one of the URIs within the remote's configuration is invalid.

Method Detail

addFetchRefSpecback to summary
public boolean addFetchRefSpec(RefSpec s)

Add a new fetch RefSpec to this remote.

Parameters
s:RefSpec

the new specification to add.

Returns:boolean

true if the specification was added; false if it already exists.

addPushRefSpecback to summary
public boolean addPushRefSpec(RefSpec s)

Add a new push RefSpec to this remote.

Parameters
s:RefSpec

the new specification to add.

Returns:boolean

true if the specification was added; false if it already exists.

addPushURIback to summary
public boolean addPushURI(URIish toAdd)

Add a new push-only URI to the end of the list of URIs.

Parameters
toAdd:URIish

the new URI to add to this remote.

Returns:boolean

true if the URI was added; false if it already exists.

addURIback to summary
public boolean addURI(URIish toAdd)

Add a new URI to the end of the list of URIs.

Parameters
toAdd:URIish

the new URI to add to this remote.

Returns:boolean

true if the URI was added; false if it already exists.

getAllRemoteConfigsback to summary
public static List<RemoteConfig> getAllRemoteConfigs(Config rc) throws URISyntaxException

Parse all remote blocks in an existing configuration file, looking for remotes configuration.

Parameters
rc:Config

the existing configuration to get the remote settings from. The configuration must already be loaded into memory.

Returns:List<RemoteConfig>

all remotes configurations existing in provided repository configuration. Returned configurations are ordered lexicographically by names.

Exceptions
URISyntaxException:
one of the URIs within the remote's configuration is invalid.
getFetchRefSpecsback to summary
public List<RefSpec> getFetchRefSpecs()

Remembered specifications for fetching from a repository.

Returns:List<RefSpec>

set of specs used by default when fetching.

getNameback to summary
public String getName()

Get the local name this remote configuration is recognized as.

Returns:String

name assigned by the user to this configuration block.

getPushRefSpecsback to summary
public List<RefSpec> getPushRefSpecs()

Remembered specifications for pushing to a repository.

Returns:List<RefSpec>

set of specs used by default when pushing.

getPushURIsback to summary
public List<URIish> getPushURIs()

Get all configured push-only URIs under this remote.

Returns:List<URIish>

the set of URIs known to this remote.

getReceivePackback to summary
public String getReceivePack()

Override for the location of 'git-receive-pack' on the remote system.

This value is only useful for an SSH style connection, where Git is asking the remote system to execute a program that provides the necessary network protocol.

Returns:String

location of 'git-receive-pack' on the remote system. If no location has been configured the default of 'git-receive-pack' is returned instead.

getTagOptback to summary
public TagOpt getTagOpt()

Get the description of how annotated tags should be treated during fetch.

Returns:TagOpt

option indicating the behavior of annotated tags in fetch.

getTimeoutback to summary
public int getTimeout()

Get timeout (in seconds) before aborting an IO operation.

Returns:int

timeout (in seconds) before aborting an IO operation.

getUploadPackback to summary
public String getUploadPack()

Override for the location of 'git-upload-pack' on the remote system.

This value is only useful for an SSH style connection, where Git is asking the remote system to execute a program that provides the necessary network protocol.

Returns:String

location of 'git-upload-pack' on the remote system. If no location has been configured the default of 'git-upload-pack' is returned instead.

getURIsback to summary
public List<URIish> getURIs()

Get all configured URIs under this remote.

Returns:List<URIish>

the set of URIs known to this remote.

isMirrorback to summary
public boolean isMirror()

Whether pushing to the remote automatically deletes remote refs which don't exist on the source side.

Returns:boolean

true if pushing to the remote automatically deletes remote refs which don't exist on the source side.

removeFetchRefSpecback to summary
public boolean removeFetchRefSpec(RefSpec s)

Remove a fetch RefSpec from this remote.

Parameters
s:RefSpec

the specification to remove.

Returns:boolean

true if the specification existed and was removed.

removePushRefSpecback to summary
public boolean removePushRefSpec(RefSpec s)

Remove a push RefSpec from this remote.

Parameters
s:RefSpec

the specification to remove.

Returns:boolean

true if the specification existed and was removed.

removePushURIback to summary
public boolean removePushURI(URIish toRemove)

Remove a push-only URI from the list of URIs.

Parameters
toRemove:URIish

the URI to remove from this remote.

Returns:boolean

true if the URI was added; false if it already exists.

removeURIback to summary
public boolean removeURI(URIish toRemove)

Remove a URI from the list of URIs.

Parameters
toRemove:URIish

the URI to remove from this remote.

Returns:boolean

true if the URI was added; false if it already exists.

setback to summary
private void set(final Config rc, final String key, final String currentValue, final String defaultValue)
setback to summary
private void set(final Config rc, final String key, final boolean currentValue, final boolean defaultValue)
setback to summary
private void set(final Config rc, final String key, final int currentValue, final int defaultValue)
setFetchRefSpecsback to summary
public void setFetchRefSpecs(List<RefSpec> specs)

Override existing fetch specifications with new ones.

Parameters
specs:List<RefSpec>

list of fetch specifications to set. List is copied, it can be modified after this call.

setMirrorback to summary
public void setMirror(boolean m)

Set the mirror flag to automatically delete remote refs.

Parameters
m:boolean

true to automatically delete remote refs during push.

setPushRefSpecsback to summary
public void setPushRefSpecs(List<RefSpec> specs)

Override existing push specifications with new ones.

Parameters
specs:List<RefSpec>

list of push specifications to set. List is copied, it can be modified after this call.

setTagOptback to summary
public void setTagOpt(TagOpt option)

Set the description of how annotated tags should be treated on fetch.

Parameters
option:TagOpt

method to use when handling annotated tags.

setTimeoutback to summary
public void setTimeout(int seconds)

Set the timeout before willing to abort an IO call.

Parameters
seconds:int

number of seconds to wait (with no data transfer occurring) before aborting an IO read or write operation with this remote. A timeout of 0 will block indefinitely.

unsetback to summary
private void unset(Config rc, String key)
updateback to summary
public void update(Config rc)

Update this remote's definition within the configuration.

Parameters
rc:Config

the configuration file to store ourselves into.