comparison src/org/tmatesoft/hg/repo/HgBundle.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 2f9ed6bcefa2
comparison
equal deleted inserted replaced
512:10ca3ede8367 513:a41d955dc360
309 final Lifecycle lifecycle = lifecycleSetUp(inspector); 309 final Lifecycle lifecycle = lifecycleSetUp(inspector);
310 DataAccess da = null; 310 DataAccess da = null;
311 try { 311 try {
312 da = getDataStream(); 312 da = getDataStream();
313 internalInspectChangelog(da, inspector); 313 internalInspectChangelog(da, inspector);
314 if (flowControl.isStopped()) {
315 return;
316 }
314 internalInspectManifest(da, inspector); 317 internalInspectManifest(da, inspector);
318 if (flowControl.isStopped()) {
319 return;
320 }
315 internalInspectFiles(da, inspector); 321 internalInspectFiles(da, inspector);
316 } catch (IOException ex) { 322 } catch (IOException ex) {
317 throw new HgInvalidFileException("Bundle.inspectAll failed", ex, bundleFile); 323 throw new HgInvalidFileException("Bundle.inspectAll failed", ex, bundleFile);
318 } finally { 324 } finally {
319 if (da != null) { 325 if (da != null) {
351 private void internalInspectChangelog(DataAccess da, Inspector inspector) throws IOException { 357 private void internalInspectChangelog(DataAccess da, Inspector inspector) throws IOException {
352 if (da.isEmpty()) { 358 if (da.isEmpty()) {
353 return; 359 return;
354 } 360 }
355 inspector.changelogStart(); 361 inspector.changelogStart();
362 if (flowControl.isStopped()) {
363 return;
364 }
356 readGroup(da, inspector); 365 readGroup(da, inspector);
366 if (flowControl.isStopped()) {
367 return;
368 }
357 inspector.changelogEnd(); 369 inspector.changelogEnd();
358 } 370 }
359 371
360 private void internalInspectManifest(DataAccess da, Inspector inspector) throws IOException { 372 private void internalInspectManifest(DataAccess da, Inspector inspector) throws IOException {
361 if (da.isEmpty()) { 373 if (da.isEmpty()) {
362 return; 374 return;
363 } 375 }
364 inspector.manifestStart(); 376 inspector.manifestStart();
377 if (flowControl.isStopped()) {
378 return;
379 }
365 readGroup(da, inspector); 380 readGroup(da, inspector);
381 if (flowControl.isStopped()) {
382 return;
383 }
366 inspector.manifestEnd(); 384 inspector.manifestEnd();
367 } 385 }
368 386
369 private void internalInspectFiles(DataAccess da, Inspector inspector) throws IOException { 387 private void internalInspectFiles(DataAccess da, Inspector inspector) throws IOException {
370 while (!da.isEmpty()) { 388 while (!da.isEmpty()) {
374 } 392 }
375 byte[] fnameBuf = new byte[fnameLen - 4]; 393 byte[] fnameBuf = new byte[fnameLen - 4];
376 da.readBytes(fnameBuf, 0, fnameBuf.length); 394 da.readBytes(fnameBuf, 0, fnameBuf.length);
377 String name = new String(fnameBuf); 395 String name = new String(fnameBuf);
378 inspector.fileStart(name); 396 inspector.fileStart(name);
397 if (flowControl.isStopped()) {
398 return;
399 }
379 readGroup(da, inspector); 400 readGroup(da, inspector);
401 if (flowControl.isStopped()) {
402 return;
403 }
380 inspector.fileEnd(name); 404 inspector.fileEnd(name);
381 } 405 }
382 } 406 }
383 407
384 private static void readGroup(DataAccess da, Inspector inspector) throws IOException { 408 private static void readGroup(DataAccess da, Inspector inspector) throws IOException {