diff src/org/tmatesoft/hg/repo/HgInternals.java @ 348:a0864b2892cd

Expose errors reading mercurial control files with exception
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 24 Nov 2011 02:57:03 +0100
parents 8da7ade36c57
children 2fadf8695f8a
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgInternals.java	Tue Nov 22 05:25:57 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgInternals.java	Thu Nov 24 02:57:03 2011 +0100
@@ -25,6 +25,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
+import org.tmatesoft.hg.core.HgInvalidControlFileException;
 import org.tmatesoft.hg.core.HgInvalidRevisionException;
 import org.tmatesoft.hg.core.SessionContext;
 import org.tmatesoft.hg.internal.Experimental;
@@ -54,16 +55,12 @@
 		repo = hgRepo;
 	}
 
-	public void dumpDirstate() {
-		getDirstate().dump();
-	}
-	
-	public HgDirstate getDirstate() {
+	public HgDirstate getDirstate() throws HgInvalidControlFileException {
 		return repo.loadDirstate(new PathPool(new PathRewrite.Empty()));
 	}
 	
 	// tests
-	public HgDirstate createDirstate(boolean caseSensitiveFileSystem) {
+	public HgDirstate createDirstate(boolean caseSensitiveFileSystem) throws HgInvalidControlFileException {
 		PathRewrite canonicalPath = null;
 		if (!caseSensitiveFileSystem) {
 			canonicalPath = new PathRewrite() {
@@ -73,7 +70,9 @@
 				}
 			};
 		}
-		return new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath);
+		HgDirstate ds = new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath);
+		ds.read();
+		return ds;
 	}
 	
 	public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) {