comparison src/org/tmatesoft/hg/internal/FNCacheFile.java @ 663:46b56864b483

Pull: phase2 - update phases from remote, fncache with added files. Tests
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 10 Jul 2013 16:41:49 +0200
parents c75297c17867
children ae2d439fbed3
comparison
equal deleted inserted replaced
662:af5223b86dd3 663:46b56864b483
74 files.add(pathFactory.path(e)); 74 files.add(pathFactory.path(e));
75 } 75 }
76 } 76 }
77 */ 77 */
78 78
79 public void write() throws IOException { 79 public void write() throws IOException { // FIXME transaction! and HgIOException
80 if (addedDotI.isEmpty() && addedDotD.isEmpty()) { 80 if (addedDotI.isEmpty() && addedDotD.isEmpty()) {
81 return; 81 return;
82 } 82 }
83 File f = repo.getRepositoryFile(FNCache); 83 File f = repo.getRepositoryFile(FNCache);
84 f.getParentFile().mkdirs(); 84 f.getParentFile().mkdirs();
112 } 112 }
113 113
114 public void addData(Path p) { 114 public void addData(Path p) {
115 addedDotD.add(p); 115 addedDotD.add(p);
116 } 116 }
117
118 /**
119 * Register new files with fncache if one is enabled for the repo, do nothing otherwise
120 */
121 public static class Mediator {
122 private final Internals repo;
123 private FNCacheFile fncache;
124
125 public Mediator(Internals internalRepo) {
126 repo = internalRepo;
127 }
128
129 public void registerNew(Path f, RevlogStream rs) {
130 if (fncache != null || repo.fncacheInUse()) {
131 if (fncache == null) {
132 fncache = new FNCacheFile(repo);
133 }
134 fncache.addIndex(f);
135 if (!rs.isInlineData()) {
136 fncache.addData(f);
137 }
138 }
139 }
140
141 public void complete() throws IOException {
142 if (fncache != null) {
143 fncache.write();
144 }
145 }
146 }
117 } 147 }