changeset 369:091666b87f62

Issue 21: Recognize extensions with prefixed names
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Dec 2011 01:46:40 +0300
parents 8107b95f4280
children a2341e761609
files src/org/tmatesoft/hg/repo/HgRepoConfig.java
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepoConfig.java	Fri Dec 16 16:00:57 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgRepoConfig.java	Thu Dec 22 01:46:40 2011 +0300
@@ -210,9 +210,19 @@
 		}
 
 		public boolean isEnabled(String extensionName) {
-			String value = config.getSection(section).get(extensionName);
-			// empty line, just "extension =" is valid way to enable it
-			return value != null && (value.length() == 0 || '!' != value.charAt(0));
+			final Map<String, String> sect = config.getSection(section);
+			String value = sect.get(extensionName);
+			if (value == null) {
+				value = sect.get("hgext." + extensionName);
+			}
+			if (value == null) {
+				value = sect.get("hgext/" + extensionName);
+			}
+			if (value != null) {
+				// empty line, just "extension =" is valid way to enable it
+				return value.length() == 0 || '!' != value.charAt(0);
+			}
+			return false;
 		}
 	}
 }