# HG changeset patch # User Artem Tikhomirov # Date 1322534777 -3600 # Node ID 33eaed1ad130257cfea0e01b5d2c9625924516ca # Parent bba9f52cacf30149b2a8b68f1b7658387fe3766f Allow FileIterator report any errors from the underlaying file system up to the client diff -r bba9f52cacf3 -r 33eaed1ad130 cmdline/org/tmatesoft/hg/console/Main.java --- 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/"); diff -r bba9f52cacf3 -r 33eaed1ad130 src/org/tmatesoft/hg/core/HgStatusCommand.java --- 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 null * @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(); } diff -r bba9f52cacf3 -r 33eaed1ad130 src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java --- 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 { diff -r bba9f52cacf3 -r 33eaed1ad130 src/org/tmatesoft/hg/util/FileIterator.java --- 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.