Thread (26 messages) flat view 26 messages, 2 authors, 2016-06-15
DORMANTno replies

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

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:47:06
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 .../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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help