comparison src/org/tmatesoft/hg/repo/HgManifest.java @ 638:2f1cd1c26de5 smartgit-4.5

AIOOBE in HgManifest.RevisionMapper: provide more details about exception context. Create lock file atomically. Picked from changeset 8a5cdcb27b8f
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 07 Jun 2013 13:21:20 +0200
parents 47dfa0ec7e35
children 5d8798772cca
comparison
equal deleted inserted replaced
590:8cbc2a883d95 638:2f1cd1c26de5
600 } 600 }
601 return changesetRevisionIndex; 601 return changesetRevisionIndex;
602 } 602 }
603 603
604 // XXX likely can be replaced with Revlog.RevisionInspector 604 // XXX likely can be replaced with Revlog.RevisionInspector
605 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { 605 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) throws HgInvalidRevisionException {
606 if (linkRevision >= changelogRevisionCount) {
607 String storeLock = repo.getStoreLock().readLockInfo();
608 String message = String.format("Manifest revision %d references changeset %d, which is beyond known scope [0..%d). Lock: %s", revisionNumber, linkRevision, changelogRevisionCount, storeLock);
609 throw new HgInvalidRevisionException(message, null, linkRevision);
610 }
606 if (changelog2manifest != null) { 611 if (changelog2manifest != null) {
607 // next assertion is not an error, rather assumption check, which is too development-related to be explicit exception - 612 // next assertion is not an error, rather assumption check, which is too development-related to be explicit exception -
608 // I just wonder if there are manifests that have two entries pointing to single changeset. It seems unrealistic, though - 613 // I just wonder if there are manifests that have two entries pointing to single changeset. It seems unrealistic, though -
609 // changeset records one and only one manifest nodeid 614 // changeset records one and only one manifest nodeid
610 assert changelog2manifest[linkRevision] == BAD_REVISION : String.format("revision:%d, link:%d, already linked to revision:%d", revisionNumber, linkRevision, changelog2manifest[linkRevision]); 615 assert changelog2manifest[linkRevision] == BAD_REVISION : String.format("revision:%d, link:%d, already linked to revision:%d", revisionNumber, linkRevision, changelog2manifest[linkRevision]);