[JGIT PATCH 04/19] Allow a RemoteConfig to use the more generic Config class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A RemoteConfig can be parsed from any Config type object, not just
the RepositoryConfig object.  This change makes it easier to use
other types of Config storage, such as in unit tests.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../org/spearce/jgit/transport/RemoteConfig.java   |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
index 93a5873..ca84acf 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
@@ -43,6 +43,7 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.spearce.jgit.lib.Config;
 import org.spearce.jgit.lib.RepositoryConfig;
 
 /**
@@ -143,7 +144,7 @@
 	 * @throws URISyntaxException
 	 *             one of the URIs within the remote's configuration is invalid.
 	 */
-	public RemoteConfig(final RepositoryConfig rc, final String remoteName)
+	public RemoteConfig(final Config rc, final String remoteName)
 			throws URISyntaxException {
 		name = remoteName;
 
@@ -192,7 +193,7 @@ public RemoteConfig(final RepositoryConfig rc, final String remoteName)
 	 * @param rc
 	 *            the configuration file to store ourselves into.
 	 */
-	public void update(final RepositoryConfig rc) {
+	public void update(final Config rc) {
 		final List<String> vlst = new ArrayList<String>();
 
 		vlst.clear();
@@ -222,7 +223,7 @@ public void update(final RepositoryConfig rc) {
 		set(rc, KEY_TIMEOUT, timeout, 0);
 	}
 
-	private void set(final RepositoryConfig rc, final String key,
+	private void set(final Config rc, final String key,
 			final String currentValue, final String defaultValue) {
 		if (defaultValue.equals(currentValue))
 			unset(rc, key);
@@ -230,7 +231,7 @@ private void set(final RepositoryConfig rc, final String key,
 			rc.setString(SECTION, getName(), key, currentValue);
 	}
 
-	private void set(final RepositoryConfig rc, final String key,
+	private void set(final Config rc, final String key,
 			final boolean currentValue, final boolean defaultValue) {
 		if (defaultValue == currentValue)
 			unset(rc, key);
@@ -238,15 +239,15 @@ private void set(final RepositoryConfig rc, final String key,
 			rc.setBoolean(SECTION, getName(), key, currentValue);
 	}
 
-	private void set(final RepositoryConfig rc, final String key,
-			final int currentValue, final int defaultValue) {
+	private void set(final Config rc, final String key, final int currentValue,
+			final int defaultValue) {
 		if (defaultValue == currentValue)
 			unset(rc, key);
 		else
 			rc.setInt(SECTION, getName(), key, currentValue);
 	}
 
-	private void unset(final RepositoryConfig rc, final String key) {
+	private void unset(final Config rc, final String key) {
 		rc.unset(SECTION, getName(), key);
 	}
 
-- 
1.6.4.rc2.216.g769fa

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]