comparison src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 431:12f668401613

FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 29 Mar 2012 20:54:04 +0200
parents 48f993aa2f41
children 7bcfbc255f48
comparison
equal deleted inserted replaced
430:d280759c2a3f 431:12f668401613
30 import org.tmatesoft.hg.internal.IntMap; 30 import org.tmatesoft.hg.internal.IntMap;
31 import org.tmatesoft.hg.internal.ManifestRevision; 31 import org.tmatesoft.hg.internal.ManifestRevision;
32 import org.tmatesoft.hg.internal.Pool; 32 import org.tmatesoft.hg.internal.Pool;
33 import org.tmatesoft.hg.util.CancelSupport; 33 import org.tmatesoft.hg.util.CancelSupport;
34 import org.tmatesoft.hg.util.CancelledException; 34 import org.tmatesoft.hg.util.CancelledException;
35 import org.tmatesoft.hg.util.Convertor;
35 import org.tmatesoft.hg.util.Path; 36 import org.tmatesoft.hg.util.Path;
36 import org.tmatesoft.hg.util.PathPool;
37 import org.tmatesoft.hg.util.PathRewrite;
38 37
39 38
40 /** 39 /**
41 * Collect status information for changes between two repository revisions. 40 * Collect status information for changes between two repository revisions.
42 * 41 *
50 // with cpython repository, ~70 000 changes, complete Log (direct out, no reverse) output 49 // with cpython repository, ~70 000 changes, complete Log (direct out, no reverse) output
51 // no cache limit, no nodeids and fname caching - OOME on changeset 1035 50 // no cache limit, no nodeids and fname caching - OOME on changeset 1035
52 // no cache limit, but with cached nodeids and filenames - 1730+ 51 // no cache limit, but with cached nodeids and filenames - 1730+
53 // cache limit 100 - 19+ minutes to process 10000, and still working (too long, stopped) 52 // cache limit 100 - 19+ minutes to process 10000, and still working (too long, stopped)
54 private final int cacheMaxSize = 50; // do not keep too much manifest revisions 53 private final int cacheMaxSize = 50; // do not keep too much manifest revisions
55 private PathPool pathPool; 54 private Convertor<Path> pathPool;
56 private final Pool<Nodeid> cacheNodes; 55 private final Pool<Nodeid> cacheNodes;
57 private final Pool<Path> cacheFilenames; 56 private final Pool<Path> cacheFilenames;
58 private final ManifestRevision emptyFakeState; 57 private final ManifestRevision emptyFakeState;
59 private Path.Matcher scope = new Path.Matcher.Any(); 58 private Path.Matcher scope = new Path.Matcher.Any();
60 59
159 * @throws HgInvalidControlFileException 158 * @throws HgInvalidControlFileException
160 */ 159 */
161 /*package-local*/ ManifestRevision raw(int rev) throws HgInvalidControlFileException { 160 /*package-local*/ ManifestRevision raw(int rev) throws HgInvalidControlFileException {
162 return get(rev); 161 return get(rev);
163 } 162 }
164 /*package-local*/ PathPool getPathPool() { 163 /*package-local*/ Convertor<Path> getPathPool() {
165 if (pathPool == null) { 164 if (pathPool == null) {
166 pathPool = new PathPool(new PathRewrite.Empty()); 165 pathPool = cacheFilenames;
167 } 166 }
168 return pathPool; 167 return pathPool;
169 } 168 }
170 169
171 /** 170 /**
172 * Allows sharing of a common path cache 171 * Allows sharing of a common path cache
173 */ 172 */
174 public void setPathPool(PathPool pathPool) { 173 public void setPathPool(Convertor<Path> pathConvertor) {
175 this.pathPool = pathPool; 174 pathPool = pathConvertor;
176 } 175 }
177 176
178 /** 177 /**
179 * Limit activity of the collector to certain sub-tree of the repository. 178 * Limit activity of the collector to certain sub-tree of the repository.
180 * @param scopeMatcher tells whether collector shall report specific path, can be <code>null</code> 179 * @param scopeMatcher tells whether collector shall report specific path, can be <code>null</code>
291 } else { 290 } else {
292 try { 291 try {
293 Path copyTarget = r2fname; 292 Path copyTarget = r2fname;
294 Path copyOrigin = getOriginIfCopy(repo, copyTarget, r1Files, rev1); 293 Path copyOrigin = getOriginIfCopy(repo, copyTarget, r1Files, rev1);
295 if (copyOrigin != null) { 294 if (copyOrigin != null) {
296 inspector.copied(getPathPool().path(copyOrigin) /*pipe through pool, just in case*/, copyTarget); 295 inspector.copied(getPathPool().mangle(copyOrigin) /*pipe through pool, just in case*/, copyTarget);
297 } else { 296 } else {
298 inspector.added(copyTarget); 297 inspector.added(copyTarget);
299 } 298 }
300 } catch (HgInvalidFileException ex) { 299 } catch (HgInvalidFileException ex) {
301 // record exception to a mediator and continue, 300 // record exception to a mediator and continue,