diff src/org/tmatesoft/hg/core/HgCloneCommand.java @ 513:a41d955dc360

Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 17 Dec 2012 15:01:57 +0100
parents 10ca3ede8367
children 0f6fa88e2162
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgCloneCommand.java	Fri Dec 14 20:10:15 2012 +0100
+++ b/src/org/tmatesoft/hg/core/HgCloneCommand.java	Mon Dec 17 15:01:57 2012 +0100
@@ -189,6 +189,7 @@
 			} catch (IOException ex) {
 				throw new HgInvalidControlFileException("Failed to write changelog", ex, new File(filename));
 			}
+			stopIfCancelled();
 		}
 
 		public void changelogEnd() {
@@ -204,6 +205,8 @@
 			} catch (IOException ex) {
 				throw new HgInvalidControlFileException("Failed to write changelog", ex, new File(filename));
 			}
+			progressSupport.worked(1);
+			stopIfCancelled();
 		}
 
 		public void manifestStart() {
@@ -215,6 +218,7 @@
 			} catch (IOException ex) {
 				throw new HgInvalidControlFileException("Failed to write manifest", ex, new File(filename));
 			}
+			stopIfCancelled();
 		}
 
 		public void manifestEnd() {
@@ -229,6 +233,8 @@
 			} catch (IOException ex) {
 				throw new HgInvalidControlFileException("Failed to write changelog", ex, new File(filename));
 			}
+			progressSupport.worked(1);
+			stopIfCancelled();
 		}
 		
 		public void fileStart(String name) {
@@ -245,6 +251,7 @@
 				String m = String.format("Failed to write file %s", filename);
 				throw new HgInvalidControlFileException(m, ex, new File(filename));
 			}
+			stopIfCancelled();
 		}
 
 		public void fileEnd(String name) {
@@ -260,6 +267,8 @@
 				String m = String.format("Failed to write file %s", filename);
 				throw new HgInvalidControlFileException(m, ex, new File(filename));
 			}
+			progressSupport.worked(1);
+			stopIfCancelled();
 		}
 
 		private int knownRevision(Nodeid p) {
@@ -360,7 +369,7 @@
 				String m = String.format("Failed to write revision %s of file %s", ge.node().shortNotation(), filename);
 				throw new HgInvalidControlFileException(m, ex, new File(filename));
 			}
-			return true;
+			return cancelException == null;
 		}
 
 		public void start(int count, Callback callback, Object token) {