Mercurial > jhg
diff 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 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java Wed Feb 02 21:19:02 2011 +0100 +++ b/src/org/tmatesoft/hg/internal/Internals.java Thu Feb 03 22:13:55 2011 +0100 @@ -16,10 +16,12 @@ */ package org.tmatesoft.hg.internal; -import static org.tmatesoft.hg.internal.RequiresFile.DOTENCODE; -import static org.tmatesoft.hg.internal.RequiresFile.FNCACHE; -import static org.tmatesoft.hg.internal.RequiresFile.STORE; +import static org.tmatesoft.hg.internal.RequiresFile.*; +import java.util.ArrayList; +import java.util.List; + +import org.tmatesoft.hg.repo.HgRepository; import org.tmatesoft.hg.util.PathRewrite; /** @@ -32,6 +34,11 @@ private int revlogVersion = 0; private int requiresFlags = 0; + private List<Filter.Factory> filterFactories; + + + public Internals() { + } public/*for tests, otherwise pkg*/ void setStorageConfig(int version, int flags) { revlogVersion = version; @@ -59,4 +66,25 @@ }; } } + + public ConfigFile newConfigFile() { + return new ConfigFile(); + } + + public List<Filter.Factory> getFilters(HgRepository hgRepo, ConfigFile cfg) { + if (filterFactories == null) { + filterFactories = new ArrayList<Filter.Factory>(); + if (cfg.hasEnabledExtension("eol")) { + NewlineFilter.Factory ff = new NewlineFilter.Factory(); + ff.initialize(hgRepo, cfg); + filterFactories.add(ff); + } + if (cfg.hasEnabledExtension("keyword")) { + KeywordFilter.Factory ff = new KeywordFilter.Factory(); + ff.initialize(hgRepo, cfg); + filterFactories.add(ff); + } + } + return filterFactories; + } }