comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 91:c2ce1cfaeb9e

ignore file with regex and 'honest' glob support
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 27 Jan 2011 06:06:42 +0100
parents c677e1593919
children ee2c750b036d
comparison
equal deleted inserted replaced
90:a95c700408a9 91:c2ce1cfaeb9e
69 private HgTags tags; 69 private HgTags tags;
70 // XXX perhaps, shall enable caching explicitly 70 // XXX perhaps, shall enable caching explicitly
71 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>(); 71 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>();
72 72
73 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals(); 73 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals();
74 private HgIgnore ignore;
74 75
75 HgRepository(String repositoryPath) { 76 HgRepository(String repositoryPath) {
76 repoDir = null; 77 repoDir = null;
77 repoLocation = repositoryPath; 78 repoLocation = repositoryPath;
78 dataAccess = null; 79 dataAccess = null;
148 /*package-local*/ final HgDirstate loadDirstate() { 149 /*package-local*/ final HgDirstate loadDirstate() {
149 return new HgDirstate(getDataAccess(), new File(repoDir, "dirstate")); 150 return new HgDirstate(getDataAccess(), new File(repoDir, "dirstate"));
150 } 151 }
151 152
152 // package-local, see comment for loadDirstate 153 // package-local, see comment for loadDirstate
153 /*package-local*/ final HgIgnore loadIgnore() { 154 /*package-local*/ final HgIgnore getIgnore() {
154 return new HgIgnore(this); 155 // TODO read config for additional locations
156 if (ignore == null) {
157 ignore = new HgIgnore();
158 try {
159 File ignoreFile = new File(repoDir.getParentFile(), ".hgignore");
160 ignore.read(ignoreFile);
161 } catch (IOException ex) {
162 ex.printStackTrace(); // log warn
163 }
164 }
165 return ignore;
155 } 166 }
156 167
157 /*package-local*/ DataAccessProvider getDataAccess() { 168 /*package-local*/ DataAccessProvider getDataAccess() {
158 return dataAccess; 169 return dataAccess;
159 } 170 }