Mercurial > hg4j
comparison src/org/tmatesoft/hg/repo/HgDirstate.java @ 291:1483e57541ef
Refactor PathRewrite to accept any char sequence, not only string
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 14 Sep 2011 02:12:47 +0200 |
parents | 8faad08c709b |
children | 9774f47d904d |
comparison
equal
deleted
inserted
replaced
290:8faad08c709b | 291:1483e57541ef |
---|---|
31 import org.tmatesoft.hg.core.Nodeid; | 31 import org.tmatesoft.hg.core.Nodeid; |
32 import org.tmatesoft.hg.internal.DataAccess; | 32 import org.tmatesoft.hg.internal.DataAccess; |
33 import org.tmatesoft.hg.util.Pair; | 33 import org.tmatesoft.hg.util.Pair; |
34 import org.tmatesoft.hg.util.Path; | 34 import org.tmatesoft.hg.util.Path; |
35 import org.tmatesoft.hg.util.PathPool; | 35 import org.tmatesoft.hg.util.PathPool; |
36 import org.tmatesoft.hg.util.PathRewrite; | |
36 | 37 |
37 | 38 |
38 /** | 39 /** |
39 * @see http://mercurial.selenic.com/wiki/DirState | 40 * @see http://mercurial.selenic.com/wiki/DirState |
40 * @see http://mercurial.selenic.com/wiki/FileFormats#dirstate | 41 * @see http://mercurial.selenic.com/wiki/FileFormats#dirstate |
49 } | 50 } |
50 | 51 |
51 private final HgRepository repo; | 52 private final HgRepository repo; |
52 private final File dirstateFile; | 53 private final File dirstateFile; |
53 private final PathPool pathPool; | 54 private final PathPool pathPool; |
55 private final PathRewrite canonicalPathRewrite; | |
54 private Map<Path, Record> normal; | 56 private Map<Path, Record> normal; |
55 private Map<Path, Record> added; | 57 private Map<Path, Record> added; |
56 private Map<Path, Record> removed; | 58 private Map<Path, Record> removed; |
57 private Map<Path, Record> merged; | 59 private Map<Path, Record> merged; |
60 private Map<Path, Path> canonical2dirstate; // map of canonicalized file names to their originals from dirstate file | |
58 private Pair<Nodeid, Nodeid> parents; | 61 private Pair<Nodeid, Nodeid> parents; |
59 private String currentBranch; | 62 private String currentBranch; |
60 | 63 |
61 /*package-local*/ HgDirstate(HgRepository hgRepo, File dirstate, PathPool pathPool) { | 64 // canonicalPath may be null if we don't need to check for names other than in dirstate |
65 /*package-local*/ HgDirstate(HgRepository hgRepo, File dirstate, PathPool pathPool, PathRewrite canonicalPath) { | |
62 repo = hgRepo; | 66 repo = hgRepo; |
63 dirstateFile = dirstate; // XXX decide whether file names shall be kept local to reader (see #branches()) or passed from outside | 67 dirstateFile = dirstate; // XXX decide whether file names shall be kept local to reader (see #branches()) or passed from outside |
64 this.pathPool = pathPool; | 68 this.pathPool = pathPool; |
69 canonicalPathRewrite = canonicalPath; | |
65 } | 70 } |
66 | 71 |
67 private void read() { | 72 private void read() { |
68 normal = added = removed = merged = Collections.<Path, Record>emptyMap(); | 73 normal = added = removed = merged = Collections.<Path, Record>emptyMap(); |
69 if (dirstateFile == null || !dirstateFile.exists()) { | 74 if (dirstateFile == null || !dirstateFile.exists()) { |