comparison src/org/tmatesoft/hg/repo/HgManifest.java @ 631:8a5cdcb27b8f

AIOOBE in HgManifest.RevisionMapper. Provide more details about exception context. Create lock file atomically. Test concurrent pull-rebase and read
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 30 May 2013 15:24:17 +0200
parents 6526d8adbc0f
children 5d8798772cca
comparison
equal deleted inserted replaced
630:72c979555cb8 631:8a5cdcb27b8f
660 } 660 }
661 return changesetRevisionIndex; 661 return changesetRevisionIndex;
662 } 662 }
663 663
664 // XXX can be replaced with Revlog.RevisionInspector, but I don't want Nodeid instances 664 // XXX can be replaced with Revlog.RevisionInspector, but I don't want Nodeid instances
665 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { 665 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) throws HgInvalidRevisionException {
666 if (linkRevision >= changelogRevisionCount) {
667 String storeLock = HgManifest.this.getRepo().getStoreLock().readLockInfo();
668 String message = String.format("Manifest revision %d references changeset %d, which is beyond known scope [0..%d). Lock: %s", revisionNumber, linkRevision, changelogRevisionCount, storeLock);
669 throw new HgInvalidRevisionException(message, null, linkRevision);
670 }
666 if (changelog2manifest != null) { 671 if (changelog2manifest != null) {
667 // next assertion is not an error, rather assumption check, which is too development-related to be explicit exception - 672 // next assertion is not an error, rather assumption check, which is too development-related to be explicit exception -
668 // I just wonder if there are manifests that have two entries pointing to single changeset. It seems unrealistic, though - 673 // I just wonder if there are manifests that have two entries pointing to single changeset. It seems unrealistic, though -
669 // changeset records one and only one manifest nodeid 674 // changeset records one and only one manifest nodeid
670 assert changelog2manifest[linkRevision] == BAD_REVISION : String.format("revision:%d, link:%d, already linked to revision:%d", revisionNumber, linkRevision, changelog2manifest[linkRevision]); 675 assert changelog2manifest[linkRevision] == BAD_REVISION : String.format("revision:%d, link:%d, already linked to revision:%d", revisionNumber, linkRevision, changelog2manifest[linkRevision]);