diff src/org/tmatesoft/hg/internal/ConfigFile.java @ 331:a37ce7145c3f

Access to repository configuration
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 05 Nov 2011 04:21:18 +0100
parents 981f9f50bb6c
children 9fb990c8a724
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/ConfigFile.java	Tue Oct 25 03:30:02 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/ConfigFile.java	Sat Nov 05 04:21:18 2011 +0100
@@ -27,7 +27,7 @@
 import java.util.Map;
 
 /**
- *
+ * .ini / .rc file reader
  * @author Artem Tikhomirov
  * @author TMate Software Ltd.
  */
@@ -44,17 +44,7 @@
 	}
 	
 	public boolean hasSection(String sectionName) {
-		return sections == null ? false : sections.indexOf(sectionName) == -1;
-	}
-	
-	// XXX perhaps, should be moved to subclass HgRepoConfig, as it is not common operation for any config file
-	public boolean hasEnabledExtension(String extensionName) {
-		int x = sections != null ? sections.indexOf("extensions") : -1;
-		if (x == -1) {
-			return false;
-		}
-		String value = content.get(x).get(extensionName);
-		return value != null && !"!".equals(value);
+		return sections == null ? false : sections.indexOf(sectionName) != -1;
 	}
 	
 	public List<String> getSectionNames() {
@@ -92,6 +82,7 @@
 
 	// TODO handle %include and %unset directives
 	// TODO "" and lists
+	// XXX perhaps, single string to keep whole section with substrings for keys/values to minimize number of arrays (String.value)
 	private void read(File f) throws IOException {
 		if (f == null || !f.canRead()) {
 			return;