public class RemoteConfig extends Object implements Serializable
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.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_RECEIVE_PACK
Default value for
getReceivePack() if not specified. |
static String |
DEFAULT_UPLOAD_PACK
Default value for
getUploadPack() if not specified. |
Constructor and Description |
---|
RemoteConfig(Config rc,
String remoteName)
Parse a remote block from an existing configuration file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addFetchRefSpec(RefSpec s)
Add a new fetch RefSpec to this remote.
|
boolean |
addPushRefSpec(RefSpec s)
Add a new push RefSpec to this remote.
|
boolean |
addPushURI(URIish toAdd)
Add a new push-only URI to the end of the list of URIs.
|
boolean |
addURI(URIish toAdd)
Add a new URI to the end of the list of URIs.
|
static List<RemoteConfig> |
getAllRemoteConfigs(Config rc)
Parse all remote blocks in an existing configuration file, looking for
remotes configuration.
|
List<RefSpec> |
getFetchRefSpecs()
Remembered specifications for fetching from a repository.
|
String |
getName()
Get the local name this remote configuration is recognized as.
|
List<RefSpec> |
getPushRefSpecs()
Remembered specifications for pushing to a repository.
|
List<URIish> |
getPushURIs()
Get all configured push-only URIs under this remote.
|
String |
getReceivePack()
Override for the location of 'git-receive-pack' on the remote system.
|
TagOpt |
getTagOpt()
Get the description of how annotated tags should be treated during fetch.
|
int |
getTimeout() |
String |
getUploadPack()
Override for the location of 'git-upload-pack' on the remote system.
|
List<URIish> |
getURIs()
Get all configured URIs under this remote.
|
boolean |
isMirror() |
boolean |
removeFetchRefSpec(RefSpec s)
Remove a fetch RefSpec from this remote.
|
boolean |
removePushRefSpec(RefSpec s)
Remove a push RefSpec from this remote.
|
boolean |
removePushURI(URIish toRemove)
Remove a push-only URI from the list of URIs.
|
boolean |
removeURI(URIish toRemove)
Remove a URI from the list of URIs.
|
void |
setFetchRefSpecs(List<RefSpec> specs)
Override existing fetch specifications with new ones.
|
void |
setMirror(boolean m)
Set the mirror flag to automatically delete remote refs.
|
void |
setPushRefSpecs(List<RefSpec> specs)
Override existing push specifications with new ones.
|
void |
setTagOpt(TagOpt option)
Set the description of how annotated tags should be treated on fetch.
|
void |
setTimeout(int seconds)
Set the timeout before willing to abort an IO call.
|
void |
update(Config rc)
Update this remote's definition within the configuration.
|
public static final String DEFAULT_UPLOAD_PACK
getUploadPack()
if not specified.public static final String DEFAULT_RECEIVE_PACK
getReceivePack()
if not specified.public RemoteConfig(Config rc, String remoteName) throws URISyntaxException
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.
rc
- the existing configuration to get the remote settings from.
The configuration must already be loaded into memory.remoteName
- subsection key indicating the name of this remote.URISyntaxException
- one of the URIs within the remote's configuration is invalid.public static List<RemoteConfig> getAllRemoteConfigs(Config rc) throws URISyntaxException
rc
- the existing configuration to get the remote settings from.
The configuration must already be loaded into memory.URISyntaxException
- one of the URIs within the remote's configuration is invalid.public void update(Config rc)
rc
- the configuration file to store ourselves into.public String getName()
public List<URIish> getURIs()
public boolean addURI(URIish toAdd)
toAdd
- the new URI to add to this remote.public boolean removeURI(URIish toRemove)
toRemove
- the URI to remove from this remote.public List<URIish> getPushURIs()
public boolean addPushURI(URIish toAdd)
toAdd
- the new URI to add to this remote.public boolean removePushURI(URIish toRemove)
toRemove
- the URI to remove from this remote.public List<RefSpec> getFetchRefSpecs()
public boolean addFetchRefSpec(RefSpec s)
s
- the new specification to add.public void setFetchRefSpecs(List<RefSpec> specs)
specs
- list of fetch specifications to set. List is copied, it can be
modified after this call.public void setPushRefSpecs(List<RefSpec> specs)
specs
- list of push specifications to set. List is copied, it can be
modified after this call.public boolean removeFetchRefSpec(RefSpec s)
s
- the specification to remove.public List<RefSpec> getPushRefSpecs()
public boolean addPushRefSpec(RefSpec s)
s
- the new specification to add.public boolean removePushRefSpec(RefSpec s)
s
- the specification to remove.public String getUploadPack()
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.
public String getReceivePack()
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.
public TagOpt getTagOpt()
public void setTagOpt(TagOpt option)
option
- method to use when handling annotated tags.public boolean isMirror()
public void setMirror(boolean m)
m
- true to automatically delete remote refs during push.public int getTimeout()
public void setTimeout(int seconds)
seconds
- 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.Copyright © 2017 Eclipse JGit Project. All rights reserved.