comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 414:bb278ccf9866

Pull changes from smartgit3 branch
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 21 Mar 2012 20:51:12 +0100
parents 866fc3b597a0 63c5a9d7ca3f
children 9c9c442b5f2e
comparison
equal deleted inserted replaced
413:7f27122011c3 414:bb278ccf9866
27 27
28 import org.tmatesoft.hg.core.HgInvalidControlFileException; 28 import org.tmatesoft.hg.core.HgInvalidControlFileException;
29 import org.tmatesoft.hg.core.HgInvalidRevisionException; 29 import org.tmatesoft.hg.core.HgInvalidRevisionException;
30 import org.tmatesoft.hg.core.SessionContext; 30 import org.tmatesoft.hg.core.SessionContext;
31 import org.tmatesoft.hg.internal.Experimental; 31 import org.tmatesoft.hg.internal.Experimental;
32 import org.tmatesoft.hg.internal.Internals;
32 import org.tmatesoft.hg.internal.RelativePathRewrite; 33 import org.tmatesoft.hg.internal.RelativePathRewrite;
34 import org.tmatesoft.hg.internal.WinToNixPathRewrite;
33 import org.tmatesoft.hg.util.FileIterator; 35 import org.tmatesoft.hg.util.FileIterator;
34 import org.tmatesoft.hg.util.FileWalker; 36 import org.tmatesoft.hg.util.FileWalker;
35 import org.tmatesoft.hg.util.Path; 37 import org.tmatesoft.hg.util.Path;
36 import org.tmatesoft.hg.util.PathPool; 38 import org.tmatesoft.hg.util.PathPool;
37 import org.tmatesoft.hg.util.PathRewrite; 39 import org.tmatesoft.hg.util.PathRewrite;
69 return path.toString().toLowerCase(); 71 return path.toString().toLowerCase();
70 } 72 }
71 }; 73 };
72 } 74 }
73 HgDirstate ds = new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath); 75 HgDirstate ds = new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath);
74 ds.read(); 76 ds.read(repo.getImplHelper().buildFileNameEncodingHelper());
75 return ds; 77 return ds;
76 } 78 }
77 79
78 public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) { 80 public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) {
79 Path[] rv = new Path[toCheck.length]; 81 Path[] rv = new Path[toCheck.length];
85 87
86 public static File getRepositoryDir(HgRepository hgRepo) { 88 public static File getRepositoryDir(HgRepository hgRepo) {
87 return hgRepo.getRepositoryRoot(); 89 return hgRepo.getRepositoryRoot();
88 } 90 }
89 91
90 public static HgIgnore newHgIgnore(Reader source) throws IOException { 92 /**
91 HgIgnore hgIgnore = new HgIgnore(); 93 * @param source where to read definitions from
94 * @param globPathRewrite <code>null</code> to use default, or pass an instance to override defaults
95 * @return
96 * @throws IOException
97 */
98 public static HgIgnore newHgIgnore(Reader source, PathRewrite globPathRewrite) throws IOException {
99 if (globPathRewrite == null) {
100 // shall match that of HgRepository#getIgnore() (Internals#buildNormalizePathRewrite())
101 if (Internals.runningOnWindows()) {
102 globPathRewrite = new WinToNixPathRewrite();
103 } else {
104 globPathRewrite = new PathRewrite.Empty();
105 }
106 }
107 HgIgnore hgIgnore = new HgIgnore(globPathRewrite);
92 BufferedReader br = source instanceof BufferedReader ? (BufferedReader) source : new BufferedReader(source); 108 BufferedReader br = source instanceof BufferedReader ? (BufferedReader) source : new BufferedReader(source);
93 hgIgnore.read(br); 109 hgIgnore.read(br);
94 br.close(); 110 br.close();
95 return hgIgnore; 111 return hgIgnore;
96 } 112 }