changeset 350:33eaed1ad130

Allow FileIterator report any errors from the underlaying file system up to the client
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 29 Nov 2011 03:46:17 +0100
parents bba9f52cacf3
children 5abba41751e6
files cmdline/org/tmatesoft/hg/console/Main.java src/org/tmatesoft/hg/core/HgStatusCommand.java src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java src/org/tmatesoft/hg/util/FileIterator.java
diffstat 4 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Thu Nov 24 04:33:42 2011 +0100
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Tue Nov 29 03:46:17 2011 +0100
@@ -19,6 +19,7 @@
 import static org.tmatesoft.hg.repo.HgRepository.TIP;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -364,7 +365,7 @@
 		return String.format("%s %s (%d bytes)", r.getPath(), r.getRevision(), sink.toArray().length);
 	}
 	
-	private void testFileStatus() {
+	private void testFileStatus() throws IOException {
 //		final Path path = Path.create("src/org/tmatesoft/hg/util/");
 //		final Path path = Path.create("src/org/tmatesoft/hg/internal/Experimental.java");
 //		final Path path = Path.create("missing-dir/");
--- a/src/org/tmatesoft/hg/core/HgStatusCommand.java	Thu Nov 24 04:33:42 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgStatusCommand.java	Tue Nov 29 03:46:17 2011 +0100
@@ -20,6 +20,7 @@
 import static org.tmatesoft.hg.repo.HgInternals.wrongLocalRevision;
 import static org.tmatesoft.hg.repo.HgRepository.*;
 
+import java.io.IOException;
 import java.util.ConcurrentModificationException;
 import java.util.concurrent.CancellationException;
 
@@ -159,10 +160,11 @@
 	 * Perform status operation according to parameters set.
 	 *  
 	 * @param handler callback to get status information
+	 * @throws IOException if there are (further unspecified) errors while walking working copy
 	 * @throws IllegalArgumentException if handler is <code>null</code>
 	 * @throws ConcurrentModificationException if this command already runs (i.e. being used from another thread)
 	 */
-	public void execute(Handler statusHandler) throws CancellationException, HgException {
+	public void execute(Handler statusHandler) throws CancellationException, HgException, IOException {
 		if (statusHandler == null) {
 			throw new IllegalArgumentException();
 		}
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Thu Nov 24 04:33:42 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Nov 29 03:46:17 2011 +0100
@@ -141,7 +141,7 @@
 	
 	// may be invoked few times, TIP or WORKING_COPY indicate comparison shall be run against working copy parent
 	// NOTE, use of TIP constant requires certain care. TIP here doesn't mean latest cset, but actual working copy parent.
-	public void walk(int baseRevision, HgStatusInspector inspector) {
+	public void walk(int baseRevision, HgStatusInspector inspector) throws IOException {
 		if (HgInternals.wrongLocalRevision(baseRevision) || baseRevision == BAD_REVISION) {
 			throw new IllegalArgumentException(String.valueOf(baseRevision));
 		}
@@ -266,7 +266,7 @@
 		}
 	}
 
-	public HgStatusCollector.Record status(int baseRevision) {
+	public HgStatusCollector.Record status(int baseRevision) throws IOException {
 		HgStatusCollector.Record rv = new HgStatusCollector.Record();
 		walk(baseRevision, rv);
 		return rv;
@@ -607,11 +607,11 @@
 			walker = fileWalker;
 		}
 
-		public void reset() {
+		public void reset() throws IOException {
 			walker.reset();
 		}
 
-		public boolean hasNext() {
+		public boolean hasNext() throws IOException {
 			while (walker.hasNext()) {
 				walker.next();
 				if (filter.accept(walker.name())) {
@@ -622,7 +622,7 @@
 			return false;
 		}
 
-		public void next() {
+		public void next() throws IOException {
 			if (didNext) {
 				didNext = false;
 			} else {
--- a/src/org/tmatesoft/hg/util/FileIterator.java	Thu Nov 24 04:33:42 2011 +0100
+++ b/src/org/tmatesoft/hg/util/FileIterator.java	Tue Nov 29 03:46:17 2011 +0100
@@ -16,6 +16,8 @@
  */
 package org.tmatesoft.hg.util;
 
+import java.io.IOException;
+
 import org.tmatesoft.hg.internal.Experimental;
 
 /**
@@ -29,17 +31,17 @@
 	/**
 	 * Brings iterator into initial state to facilitate new use.
 	 */
-	void reset();
+	void reset() throws IOException;
 
 	/**
 	 * @return whether can shift to next element
 	 */
-	boolean hasNext();
+	boolean hasNext() throws IOException;
 
 	/**
 	 * Shift to next element
 	 */
-	void next();
+	void next() throws IOException;
 
 	/**
 	 * @return repository-local path to the current element.