diff 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
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgManifest.java	Thu May 23 19:44:28 2013 +0200
+++ b/src/org/tmatesoft/hg/repo/HgManifest.java	Thu May 30 15:24:17 2013 +0200
@@ -662,7 +662,12 @@
 		}
 
 		// XXX can be replaced with Revlog.RevisionInspector, but I don't want Nodeid instances
-		public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) {
+		public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) throws HgInvalidRevisionException {
+			if (linkRevision >= changelogRevisionCount) {
+				String storeLock = HgManifest.this.getRepo().getStoreLock().readLockInfo();
+				String message = String.format("Manifest revision %d references changeset %d, which is beyond known scope [0..%d). Lock: %s", revisionNumber, linkRevision, changelogRevisionCount, storeLock);
+				throw new HgInvalidRevisionException(message, null, linkRevision);
+			}
 			if (changelog2manifest != null) {
 				// next assertion is not an error, rather assumption check, which is too development-related to be explicit exception - 
 				// I just wonder if there are manifests that have two entries pointing to single changeset. It seems unrealistic, though -