diff src/org/tmatesoft/hg/repo/HgRepository.java @ 628:6526d8adbc0f

Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 22 May 2013 15:52:31 +0200
parents 99ad1e3a4e4d
children ffce73efa2c2
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Tue May 21 20:17:33 2013 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Wed May 22 15:52:31 2013 +0200
@@ -27,6 +27,7 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.tmatesoft.hg.core.HgIOException;
 import org.tmatesoft.hg.core.Nodeid;
 import org.tmatesoft.hg.core.SessionContext;
 import org.tmatesoft.hg.internal.ConfigFile;
@@ -195,7 +196,7 @@
 	 * 
 	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
 	 */
-	public HgTags getTags() throws HgInvalidControlFileException {
+	public HgTags getTags() throws HgRuntimeException {
 		if (tags == null) {
 			tags = new HgTags(impl);
 			tags.read();
@@ -212,7 +213,7 @@
 	 * @return branch manager instance, never <code>null</code>
 	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
 	 */
-	public HgBranches getBranches() throws HgInvalidControlFileException {
+	public HgBranches getBranches() throws HgRuntimeException {
 		final ProgressSupport ps = ProgressSupport.Factory.get(null);
 		if (branches == null) {
 			branches = new HgBranches(impl);
@@ -226,10 +227,12 @@
 	/**
 	 * Access state of the recent merge
 	 * @return merge state facility, never <code>null</code> 
+	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
 	 */
-	public HgMergeState getMergeState() {
+	public HgMergeState getMergeState() throws HgRuntimeException {
 		if (mergeState == null) {
 			mergeState = new HgMergeState(impl);
+			mergeState.refresh();
 		}
 		return mergeState;
 	}
@@ -305,7 +308,7 @@
 			try {
 				ConfigFile configFile = impl.readConfiguration();
 				repoConfig = new HgRepoConfig(configFile);
-			} catch (IOException ex) {
+			} catch (HgIOException ex) {
 				String m = "Errors while reading user configuration file";
 				getSessionContext().getLog().dump(getClass(), Warn, ex, m);
 				return new HgRepoConfig(new ConfigFile(getSessionContext())); // empty config, do not cache, allow to try once again
@@ -424,7 +427,7 @@
 	 * @return facility to manage bookmarks, never <code>null</code>
 	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
 	 */
-	public HgBookmarks getBookmarks() throws HgInvalidControlFileException {
+	public HgBookmarks getBookmarks() throws HgRuntimeException {
 		if (bookmarks == null) {
 			bookmarks = new HgBookmarks(impl);
 			bookmarks.read();