comparison src/org/tmatesoft/hg/repo/Revlog.java @ 445:d0e5dc3cae6e smartgit3

Support for phases functionality from Mercurial 2.1
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Jun 2012 20:50:06 +0200
parents 728708de3597
children 2e402c12ebc6
comparison
equal deleted inserted replaced
412:63c5a9d7ca3f 445:d0e5dc3cae6e
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 @Experimental 259 @Experimental
260 public void walk(int start, int end, final Revlog.Inspector inspector) throws HgInvalidRevisionException, HgInvalidControlFileException { 260 public final void walk(int start, int end, final Revlog.Inspector inspector) throws HgInvalidRevisionException, HgInvalidControlFileException {
261 int lastRev = getLastRevision(); 261 int lastRev = getLastRevision();
262 if (start == TIP) { 262 if (start == TIP) {
263 start = lastRev; 263 start = lastRev;
264 } 264 }
265 if (end == TIP) { 265 if (end == TIP) {
266 end = lastRev; 266 end = lastRev;
267 } 267 }
268 final RevisionInspector revisionInsp = Adaptable.Factory.getAdapter(inspector, RevisionInspector.class, null); 268 final RevisionInspector revisionInsp = Adaptable.Factory.getAdapter(inspector, RevisionInspector.class, null);
269 final ParentInspector parentInsp = Adaptable.Factory.getAdapter(inspector, ParentInspector.class, null); 269 final ParentInspector parentInsp = Adaptable.Factory.getAdapter(inspector, ParentInspector.class, null);
270 final Nodeid[] allRevisions = parentInsp == null ? null : new Nodeid[end - start + 1]; 270 final Nodeid[] allRevisions = parentInsp == null ? null : new Nodeid[end - start + 1];
271 if (parentInsp != null && start != 0) {
272 // e.g. start == 6, end == 7 and parentOf(start) == 5. allRevisions.length == 2, allRevisions[parentOf(start)] => AIOOBE
273 throw new IllegalStateException("There's a defect in the code that doesn't allow walks other than from the very beginning");
274 // TestAuxUtilities#testRevlogInspectors
275 }
271 276
272 content.iterate(start, end, false, new RevlogStream.Inspector() { 277 content.iterate(start, end, false, new RevlogStream.Inspector() {
273 278
274 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { 279 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) {
275 Nodeid nid = Nodeid.fromBinary(nodeid, 0); 280 Nodeid nid = Nodeid.fromBinary(nodeid, 0);