comparison src/org/tmatesoft/hg/repo/HgManifest.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 063b0663495a
children 909306e412e2
comparison
equal deleted inserted replaced
430:d280759c2a3f 431:12f668401613
31 import org.tmatesoft.hg.internal.DigestHelper; 31 import org.tmatesoft.hg.internal.DigestHelper;
32 import org.tmatesoft.hg.internal.EncodingHelper; 32 import org.tmatesoft.hg.internal.EncodingHelper;
33 import org.tmatesoft.hg.internal.IntMap; 33 import org.tmatesoft.hg.internal.IntMap;
34 import org.tmatesoft.hg.internal.IterateControlMediator; 34 import org.tmatesoft.hg.internal.IterateControlMediator;
35 import org.tmatesoft.hg.internal.Lifecycle; 35 import org.tmatesoft.hg.internal.Lifecycle;
36 import org.tmatesoft.hg.internal.Pool2; 36 import org.tmatesoft.hg.internal.IdentityPool;
37 import org.tmatesoft.hg.internal.RevlogStream; 37 import org.tmatesoft.hg.internal.RevlogStream;
38 import org.tmatesoft.hg.util.CancelSupport; 38 import org.tmatesoft.hg.util.CancelSupport;
39 import org.tmatesoft.hg.util.Path; 39 import org.tmatesoft.hg.util.Path;
40 import org.tmatesoft.hg.util.ProgressSupport; 40 import org.tmatesoft.hg.util.ProgressSupport;
41 41
434 } 434 }
435 } 435 }
436 436
437 private static class ManifestParser implements RevlogStream.Inspector, Lifecycle { 437 private static class ManifestParser implements RevlogStream.Inspector, Lifecycle {
438 private final Inspector inspector; 438 private final Inspector inspector;
439 private Pool2<Nodeid> nodeidPool, thisRevPool; 439 private IdentityPool<Nodeid> nodeidPool, thisRevPool;
440 private final Pool2<PathProxy> fnamePool; 440 private final IdentityPool<PathProxy> fnamePool;
441 private byte[] nodeidLookupBuffer = new byte[20]; // get reassigned each time new Nodeid is added to pool 441 private byte[] nodeidLookupBuffer = new byte[20]; // get reassigned each time new Nodeid is added to pool
442 private final ProgressSupport progressHelper; 442 private final ProgressSupport progressHelper;
443 private IterateControlMediator iterateControl; 443 private IterateControlMediator iterateControl;
444 private final EncodingHelper encHelper; 444 private final EncodingHelper encHelper;
445 445
446 public ManifestParser(Inspector delegate, EncodingHelper eh) { 446 public ManifestParser(Inspector delegate, EncodingHelper eh) {
447 assert delegate != null; 447 assert delegate != null;
448 inspector = delegate; 448 inspector = delegate;
449 encHelper = eh; 449 encHelper = eh;
450 nodeidPool = new Pool2<Nodeid>(); 450 nodeidPool = new IdentityPool<Nodeid>();
451 fnamePool = new Pool2<PathProxy>(); 451 fnamePool = new IdentityPool<PathProxy>();
452 thisRevPool = new Pool2<Nodeid>(); 452 thisRevPool = new IdentityPool<Nodeid>();
453 progressHelper = ProgressSupport.Factory.get(delegate); 453 progressHelper = ProgressSupport.Factory.get(delegate);
454 } 454 }
455 455
456 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess da) { 456 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess da) {
457 try { 457 try {
516 // 516 //
517 // keep only actual file revisions, found at this version 517 // keep only actual file revisions, found at this version
518 // (next manifest is likely to refer to most of them, although in specific cases 518 // (next manifest is likely to refer to most of them, although in specific cases
519 // like commit in another branch a lot may be useless) 519 // like commit in another branch a lot may be useless)
520 nodeidPool.clear(); 520 nodeidPool.clear();
521 Pool2<Nodeid> t = nodeidPool; 521 IdentityPool<Nodeid> t = nodeidPool;
522 nodeidPool = thisRevPool; 522 nodeidPool = thisRevPool;
523 thisRevPool = t; 523 thisRevPool = t;
524 iterateControl.checkCancelled(); 524 iterateControl.checkCancelled();
525 progressHelper.worked(1); 525 progressHelper.worked(1);
526 } catch (IOException ex) { 526 } catch (IOException ex) {