comparison src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 222:373e07cd3991

Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 19 May 2011 05:02:07 +0200
parents 04735ce6bed2
children 26ad7827a62d
comparison
equal deleted inserted replaced
221:04735ce6bed2 222:373e07cd3991
63 cache = new TreeMap<Integer, ManifestRevisionInspector>(); 63 cache = new TreeMap<Integer, ManifestRevisionInspector>();
64 cacheNodes = new Pool<Nodeid>(); 64 cacheNodes = new Pool<Nodeid>();
65 cacheFilenames = new Pool<String>(); 65 cacheFilenames = new Pool<String>();
66 66
67 emptyFakeState = new ManifestRevisionInspector(null, null); 67 emptyFakeState = new ManifestRevisionInspector(null, null);
68 emptyFakeState.begin(-1, null); 68 emptyFakeState.begin(-1, null, -1);
69 emptyFakeState.end(-1); 69 emptyFakeState.end(-1);
70 } 70 }
71 71
72 public HgRepository getRepo() { 72 public HgRepository getRepo() {
73 return repo; 73 return repo;
101 } 101 }
102 repo.getManifest().walk(minRev, maxRev, new HgManifest.Inspector() { 102 repo.getManifest().walk(minRev, maxRev, new HgManifest.Inspector() {
103 private ManifestRevisionInspector delegate; 103 private ManifestRevisionInspector delegate;
104 private boolean cacheHit; // range may include revisions we already know about, do not re-create them 104 private boolean cacheHit; // range may include revisions we already know about, do not re-create them
105 105
106 public boolean begin(int revision, Nodeid nid) { 106 public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) {
107 assert delegate == null; 107 assert delegate == null;
108 if (cache.containsKey(revision)) { // don't need to check emptyFakeState hit as revision never -1 here 108 if (cache.containsKey(changelogRevision)) { // don't need to check emptyFakeState hit as revision never -1 here
109 cacheHit = true; 109 cacheHit = true;
110 } else { 110 } else {
111 cache.put(revision, delegate = new ManifestRevisionInspector(cacheNodes, cacheFilenames)); 111 cache.put(changelogRevision, delegate = new ManifestRevisionInspector(cacheNodes, cacheFilenames));
112 // cache may grow bigger than max size here, but it's ok as present simplistic cache clearing mechanism may 112 // cache may grow bigger than max size here, but it's ok as present simplistic cache clearing mechanism may
113 // otherwise remove entries we just added 113 // otherwise remove entries we just added
114 delegate.begin(revision, nid); 114 delegate.begin(manifestRevision, nid, changelogRevision);
115 cacheHit = false; 115 cacheHit = false;
116 } 116 }
117 return true; 117 return true;
118 } 118 }
119 119
456 public boolean end(int revision) { 456 public boolean end(int revision) {
457 // in fact, this class cares about single revision 457 // in fact, this class cares about single revision
458 return false; 458 return false;
459 } 459 }
460 460
461 public boolean begin(int revision, Nodeid nid) { 461 public boolean begin(int revision, Nodeid nid, int changelogRevision) {
462 return true; 462 return true;
463 } 463 }
464 } 464 }
465 465
466 } 466 }