Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/Internals.java @ 114:46291ec605a0
Filters to read and initialize according to configuration files
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 03 Feb 2011 22:13:55 +0100 |
parents | a3a2e5deb320 |
children | 6b55f10ef54b |
comparison
equal
deleted
inserted
replaced
113:67ae317408c9 | 114:46291ec605a0 |
---|---|
14 * the terms of a license other than GNU General Public License | 14 * the terms of a license other than GNU General Public License |
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.internal; | 17 package org.tmatesoft.hg.internal; |
18 | 18 |
19 import static org.tmatesoft.hg.internal.RequiresFile.DOTENCODE; | 19 import static org.tmatesoft.hg.internal.RequiresFile.*; |
20 import static org.tmatesoft.hg.internal.RequiresFile.FNCACHE; | |
21 import static org.tmatesoft.hg.internal.RequiresFile.STORE; | |
22 | 20 |
21 import java.util.ArrayList; | |
22 import java.util.List; | |
23 | |
24 import org.tmatesoft.hg.repo.HgRepository; | |
23 import org.tmatesoft.hg.util.PathRewrite; | 25 import org.tmatesoft.hg.util.PathRewrite; |
24 | 26 |
25 /** | 27 /** |
26 * Fields/members that shall not be visible | 28 * Fields/members that shall not be visible |
27 * | 29 * |
30 */ | 32 */ |
31 public class Internals { | 33 public class Internals { |
32 | 34 |
33 private int revlogVersion = 0; | 35 private int revlogVersion = 0; |
34 private int requiresFlags = 0; | 36 private int requiresFlags = 0; |
37 private List<Filter.Factory> filterFactories; | |
38 | |
39 | |
40 public Internals() { | |
41 } | |
35 | 42 |
36 public/*for tests, otherwise pkg*/ void setStorageConfig(int version, int flags) { | 43 public/*for tests, otherwise pkg*/ void setStorageConfig(int version, int flags) { |
37 revlogVersion = version; | 44 revlogVersion = version; |
38 requiresFlags = flags; | 45 requiresFlags = flags; |
39 } | 46 } |
57 return path; | 64 return path; |
58 } | 65 } |
59 }; | 66 }; |
60 } | 67 } |
61 } | 68 } |
69 | |
70 public ConfigFile newConfigFile() { | |
71 return new ConfigFile(); | |
72 } | |
73 | |
74 public List<Filter.Factory> getFilters(HgRepository hgRepo, ConfigFile cfg) { | |
75 if (filterFactories == null) { | |
76 filterFactories = new ArrayList<Filter.Factory>(); | |
77 if (cfg.hasEnabledExtension("eol")) { | |
78 NewlineFilter.Factory ff = new NewlineFilter.Factory(); | |
79 ff.initialize(hgRepo, cfg); | |
80 filterFactories.add(ff); | |
81 } | |
82 if (cfg.hasEnabledExtension("keyword")) { | |
83 KeywordFilter.Factory ff = new KeywordFilter.Factory(); | |
84 ff.initialize(hgRepo, cfg); | |
85 filterFactories.add(ff); | |
86 } | |
87 } | |
88 return filterFactories; | |
89 } | |
62 } | 90 } |