comparison src/org/tmatesoft/hg/internal/KeywordFilter.java @ 331:a37ce7145c3f

Access to repository configuration
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 05 Nov 2011 04:21:18 +0100
parents ba2bf656f00f
children 5f9073eabf06
comparison
equal deleted inserted replaced
330:9747a786a34d 331:a37ce7145c3f
16 */ 16 */
17 package org.tmatesoft.hg.internal; 17 package org.tmatesoft.hg.internal;
18 18
19 import java.nio.ByteBuffer; 19 import java.nio.ByteBuffer;
20 import java.util.ArrayList; 20 import java.util.ArrayList;
21 import java.util.Map;
22 import java.util.TreeMap; 21 import java.util.TreeMap;
23 22
24 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 23 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
25 import org.tmatesoft.hg.repo.HgRepository; 24 import org.tmatesoft.hg.repo.HgRepository;
25 import org.tmatesoft.hg.util.Pair;
26 import org.tmatesoft.hg.util.Path; 26 import org.tmatesoft.hg.util.Path;
27 27
28 /** 28 /**
29 * 29 *
30 * @author Artem Tikhomirov 30 * @author Artem Tikhomirov
278 public static class Factory implements Filter.Factory { 278 public static class Factory implements Filter.Factory {
279 279
280 private HgRepository repo; 280 private HgRepository repo;
281 private Path.Matcher matcher; 281 private Path.Matcher matcher;
282 282
283 public void initialize(HgRepository hgRepo, ConfigFile cfg) { 283 public void initialize(HgRepository hgRepo) {
284 repo = hgRepo; 284 repo = hgRepo;
285 ArrayList<String> patterns = new ArrayList<String>(); 285 ArrayList<String> patterns = new ArrayList<String>();
286 for (Map.Entry<String,String> e : cfg.getSection("keyword").entrySet()) { 286 for (Pair<String,String> e : hgRepo.getConfiguration().getSection("keyword")) {
287 if (!"ignore".equalsIgnoreCase(e.getValue())) { 287 if (!"ignore".equalsIgnoreCase(e.second())) {
288 patterns.add(e.getKey()); 288 patterns.add(e.first());
289 } 289 }
290 } 290 }
291 matcher = new PathGlobMatcher(patterns.toArray(new String[patterns.size()])); 291 matcher = new PathGlobMatcher(patterns.toArray(new String[patterns.size()]));
292 // TODO read and respect keyword patterns from [keywordmaps] 292 // TODO read and respect keyword patterns from [keywordmaps]
293 } 293 }