changeset 572:becd2a1310a2

Report file object in case of error to be helpful as much as possible
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 12 Apr 2013 18:30:55 +0200
parents e4ee4bf4c7d0
children e49f9d9513fa
files src/org/tmatesoft/hg/core/HgCheckoutCommand.java src/org/tmatesoft/hg/internal/WorkingDirFileWriter.java
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgCheckoutCommand.java	Thu Apr 11 16:27:06 2013 +0200
+++ b/src/org/tmatesoft/hg/core/HgCheckoutCommand.java	Fri Apr 12 18:30:55 2013 +0200
@@ -191,17 +191,18 @@
 		}
 		
 		public boolean next(Nodeid nid, Path fname, Flags flags) {
+			WorkingDirFileWriter workingDirWriter = null;
 			try {
 				HgDataFile df = hgRepo.getRepo().getFileNode(fname);
 				int fileRevIndex = df.getRevisionIndex(nid);
 				// check out files based on manifest
 				// FIXME links!
-				WorkingDirFileWriter workingDirWriter = new WorkingDirFileWriter(hgRepo);
+				workingDirWriter = new WorkingDirFileWriter(hgRepo);
 				workingDirWriter.processFile(df, fileRevIndex);
 				lastWrittenFileSize = workingDirWriter.bytesWritten();
 				return true;
 			} catch (IOException ex) {
-				failure = new HgIOException("Failed to write down file revision", ex, /*FIXME file*/null);
+				failure = new HgIOException("Failed to write down file revision", ex, workingDirWriter.getDestinationFile());
 			} catch (HgRuntimeException ex) {
 				failure = new HgLibraryFailureException(ex);
 			}
--- a/src/org/tmatesoft/hg/internal/WorkingDirFileWriter.java	Thu Apr 11 16:27:06 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/WorkingDirFileWriter.java	Fri Apr 12 18:30:55 2013 +0200
@@ -45,6 +45,13 @@
 		hgRepo = internalRepo;
 	}
 	
+	/**
+	 * Information purposes only, to find out trouble location if {@link #processFile(HgDataFile, int)} fails
+	 */
+	public File getDestinationFile() {
+		return dest;
+	}
+	
 	public void processFile(HgDataFile df, int fileRevIndex) throws IOException {
 		try {
 			prepare(df.getPath());