Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Internals.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 | 5abba41751e6 |
comparison
equal
deleted
inserted
replaced
330:9747a786a34d | 331:a37ce7145c3f |
---|---|
23 import java.io.IOException; | 23 import java.io.IOException; |
24 import java.util.ArrayList; | 24 import java.util.ArrayList; |
25 import java.util.List; | 25 import java.util.List; |
26 | 26 |
27 import org.tmatesoft.hg.repo.HgInternals; | 27 import org.tmatesoft.hg.repo.HgInternals; |
28 import org.tmatesoft.hg.repo.HgRepoConfig.ExtensionsSection; | |
28 import org.tmatesoft.hg.repo.HgRepository; | 29 import org.tmatesoft.hg.repo.HgRepository; |
29 import org.tmatesoft.hg.util.PathRewrite; | 30 import org.tmatesoft.hg.util.PathRewrite; |
30 | 31 |
31 /** | 32 /** |
32 * Fields/members that shall not be visible | 33 * Fields/members that shall not be visible |
71 } else { | 72 } else { |
72 return new PathRewrite.Empty(); | 73 return new PathRewrite.Empty(); |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 public List<Filter.Factory> getFilters(HgRepository hgRepo, ConfigFile cfg) { | 77 public List<Filter.Factory> getFilters(HgRepository hgRepo) { |
77 if (filterFactories == null) { | 78 if (filterFactories == null) { |
78 filterFactories = new ArrayList<Filter.Factory>(); | 79 filterFactories = new ArrayList<Filter.Factory>(); |
79 if (cfg.hasEnabledExtension("eol")) { | 80 ExtensionsSection cfg = hgRepo.getConfiguration().getExtensions(); |
81 if (cfg.isEnabled("eol")) { | |
80 NewlineFilter.Factory ff = new NewlineFilter.Factory(); | 82 NewlineFilter.Factory ff = new NewlineFilter.Factory(); |
81 ff.initialize(hgRepo, cfg); | 83 ff.initialize(hgRepo); |
82 filterFactories.add(ff); | 84 filterFactories.add(ff); |
83 } | 85 } |
84 if (cfg.hasEnabledExtension("keyword")) { | 86 if (cfg.isEnabled("keyword")) { |
85 KeywordFilter.Factory ff = new KeywordFilter.Factory(); | 87 KeywordFilter.Factory ff = new KeywordFilter.Factory(); |
86 ff.initialize(hgRepo, cfg); | 88 ff.initialize(hgRepo); |
87 filterFactories.add(ff); | 89 filterFactories.add(ff); |
88 } | 90 } |
89 } | 91 } |
90 return filterFactories; | 92 return filterFactories; |
91 } | 93 } |
111 | 113 |
112 public static boolean runningOnWindows() { | 114 public static boolean runningOnWindows() { |
113 return System.getProperty("os.name").indexOf("Windows") != -1; | 115 return System.getProperty("os.name").indexOf("Windows") != -1; |
114 } | 116 } |
115 | 117 |
118 public ConfigFile readConfiguration(HgRepository hgRepo, File repoRoot) throws IOException { | |
119 ConfigFile configFile = new ConfigFile(); | |
120 // FIXME use Unix/Win location according to runningOnWindows | |
121 configFile.addLocation(new File(System.getProperty("user.home"), ".hgrc")); | |
122 // last one, overrides anything else | |
123 // <repo>/.hg/hgrc | |
124 configFile.addLocation(new File(repoRoot, "hgrc")); | |
125 return configFile; | |
126 } | |
116 } | 127 } |