comparison src/org/tmatesoft/hg/internal/NewlineFilter.java @ 490:b3c16d1aede0

Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 16 Aug 2012 17:08:34 +0200
parents e31e85cf4d4c
children 6526d8adbc0f
comparison
equal deleted inserted replaced
489:9c0138cda59a 490:b3c16d1aede0
26 import java.io.File; 26 import java.io.File;
27 import java.nio.ByteBuffer; 27 import java.nio.ByteBuffer;
28 import java.util.ArrayList; 28 import java.util.ArrayList;
29 import java.util.Map; 29 import java.util.Map;
30 30
31 import org.tmatesoft.hg.repo.HgInternals;
32 import org.tmatesoft.hg.repo.HgInvalidFileException; 31 import org.tmatesoft.hg.repo.HgInvalidFileException;
33 import org.tmatesoft.hg.repo.HgInvalidStateException; 32 import org.tmatesoft.hg.repo.HgInvalidStateException;
34 import org.tmatesoft.hg.repo.HgRepository; 33 import org.tmatesoft.hg.repo.HgRepository;
35 import org.tmatesoft.hg.util.Adaptable; 34 import org.tmatesoft.hg.util.Adaptable;
36 import org.tmatesoft.hg.util.Path; 35 import org.tmatesoft.hg.util.Path;
310 // HgDataFile cfgFileNode = hgRepo.getFileNode(".hgeol"); 309 // HgDataFile cfgFileNode = hgRepo.getFileNode(".hgeol");
311 // if (!cfgFileNode.exists()) { 310 // if (!cfgFileNode.exists()) {
312 // return; 311 // return;
313 // } 312 // }
314 // XXX perhaps, add HgDataFile.hasWorkingCopy and workingCopyContent()? 313 // XXX perhaps, add HgDataFile.hasWorkingCopy and workingCopyContent()?
315 ConfigFile hgeol = new ConfigFile(HgInternals.getContext(hgRepo)); 314 ConfigFile hgeol = new ConfigFile(hgRepo.getSessionContext());
316 try { 315 try {
317 hgeol.addLocation(cfgFile); 316 hgeol.addLocation(cfgFile);
318 } catch (HgInvalidFileException ex) { 317 } catch (HgInvalidFileException ex) {
319 HgInternals.getContext(hgRepo).getLog().dump(getClass(), Warn, ex, null); 318 hgRepo.getSessionContext().getLog().dump(getClass(), Warn, ex, null);
320 } 319 }
321 nativeRepoFormat = hgeol.getSection("repository").get("native"); 320 nativeRepoFormat = hgeol.getSection("repository").get("native");
322 if (nativeRepoFormat == null) { 321 if (nativeRepoFormat == null) {
323 nativeRepoFormat = "LF"; 322 nativeRepoFormat = "LF";
324 } 323 }
337 } else if ("native".equals(e.getValue())) { 336 } else if ("native".equals(e.getValue())) {
338 nativePatterns.add(e.getKey()); 337 nativePatterns.add(e.getKey());
339 } else if ("BIN".equals(e.getValue())) { 338 } else if ("BIN".equals(e.getValue())) {
340 binPatterns.add(e.getKey()); 339 binPatterns.add(e.getKey());
341 } else { 340 } else {
342 HgInternals.getContext(hgRepo).getLog().dump(getClass(), Warn, "Can't recognize .hgeol entry: %s for %s", e.getValue(), e.getKey()); 341 hgRepo.getSessionContext().getLog().dump(getClass(), Warn, "Can't recognize .hgeol entry: %s for %s", e.getValue(), e.getKey());
343 } 342 }
344 } 343 }
345 if (!crlfPatterns.isEmpty()) { 344 if (!crlfPatterns.isEmpty()) {
346 crlfMatcher = new PathGlobMatcher(crlfPatterns.toArray(new String[crlfPatterns.size()])); 345 crlfMatcher = new PathGlobMatcher(crlfPatterns.toArray(new String[crlfPatterns.size()]));
347 } 346 }