diff src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 366:189dc6dc1c3e

Use exceptions to expose errors reading mercurial data
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Dec 2011 04:43:18 +0100
parents 150500515714
children 2fadf8695f8a
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Sun Dec 11 00:39:07 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Fri Dec 16 04:43:18 2011 +0100
@@ -75,7 +75,7 @@
 		return repo;
 	}
 	
-	private ManifestRevision get(int rev) {
+	private ManifestRevision get(int rev) throws HgInvalidControlFileException {
 		ManifestRevision i = cache.get(rev);
 		if (i == null) {
 			if (rev == -1) {
@@ -100,7 +100,7 @@
 		}
 	}
 	
-	private void initCacheRange(int minRev, int maxRev) {
+	private void initCacheRange(int minRev, int maxRev) throws HgInvalidControlFileException {
 		ensureCacheSize();
 		// In fact, walk(minRev, maxRev) doesn't imply
 		// there would be maxRev-minRev+1 revisions visited. For example,
@@ -159,7 +159,7 @@
 		return fakeEmptyRev;
 	}
 	
-	/*package-local*/ ManifestRevision raw(int rev) {
+	/*package-local*/ ManifestRevision raw(int rev) throws HgInvalidControlFileException {
 		return get(rev);
 	}
 	/*package-local*/ PathPool getPathPool() {
@@ -186,7 +186,7 @@
 	}
 	
 	// hg status --change <rev>
-	public void change(int rev, HgStatusInspector inspector) {
+	public void change(int rev, HgStatusInspector inspector) throws /*FIXME HInvalidRevisionException,*/ HgInvalidControlFileException {
 		int[] parents = new int[2];
 		repo.getChangelog().parents(rev, parents, null, null);
 		walk(parents[0], rev, inspector);
@@ -196,7 +196,7 @@
 	// Either rev1 or rev2 may be -1 to indicate comparison to empty repository (XXX this is due to use of 
 	// parents in #change(), I believe. Perhaps, need a constant for this? Otherwise this hidden knowledge gets
 	// exposed to e.g. Record
-	public void walk(int rev1, int rev2, HgStatusInspector inspector) {
+	public void walk(int rev1, int rev2, HgStatusInspector inspector) throws /*FIXME HInvalidRevisionException,*/ HgInvalidControlFileException {
 		if (rev1 == rev2) {
 			throw new IllegalArgumentException();
 		}
@@ -284,7 +284,7 @@
 		}
 	}
 	
-	public Record status(int rev1, int rev2) {
+	public Record status(int rev1, int rev2) throws /*FIXME HInvalidRevisionException,*/ HgInvalidControlFileException {
 		Record rv = new Record();
 		walk(rev1, rev2, rv);
 		return rv;
@@ -347,7 +347,7 @@
 			statusHelper = self;
 		}
 		
-		public Nodeid nodeidBeforeChange(Path fname) {
+		public Nodeid nodeidBeforeChange(Path fname) throws HgInvalidControlFileException {
 			if (statusHelper == null || startRev == BAD_REVISION) {
 				return null;
 			}
@@ -356,7 +356,7 @@
 			}
 			return statusHelper.raw(startRev).nodeid(fname);
 		}
-		public Nodeid nodeidAfterChange(Path fname) {
+		public Nodeid nodeidAfterChange(Path fname) throws HgInvalidControlFileException {
 			if (statusHelper == null || endRev == BAD_REVISION) {
 				return null;
 			}