diff src/org/tmatesoft/hg/repo/HgManifest.java @ 257:f39fb6b3cc76

Handle revision constants correctly
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 16 Aug 2011 22:07:16 +0200
parents a620f0663a37
children 3dcd3dd90c77
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgManifest.java	Tue Aug 16 15:45:47 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgManifest.java	Tue Aug 16 22:07:16 2011 +0200
@@ -90,6 +90,10 @@
 		if (HgInternals.wrongLocalRevision(revisionNumber)) {
 			throw new IllegalArgumentException(String.valueOf(revisionNumber));
 		}
+		if (revisionNumber == HgRepository.WORKING_COPY || revisionNumber == HgRepository.BAD_REVISION) {
+			throw new IllegalArgumentException("Can't use constants like WORKING_COPY or BAD_REVISION");
+		}
+		// revisionNumber == TIP is processed by RevisionMapper 
 		if (revisionMap == null) {
 			revisionMap = new RevisionMapper(getRepo());
 			content.iterate(0, TIP, false, revisionMap);
@@ -211,7 +215,11 @@
 			changelogRevisions = repo.getChangelog().getRevisionCount();
 		}
 
+		// respects TIP
 		public int at(int revisionNumber) {
+			if (revisionNumber == TIP) {
+				revisionNumber = changelogRevisions - 1;
+			}
 			if (changelog2manifest != null) {
 				return changelog2manifest[revisionNumber];
 			}