comparison src/org/tmatesoft/hg/internal/RepositoryComparator.java @ 207:1bf0a5af2d5d

Conditional debug printouts
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 28 Apr 2011 03:10:56 +0200
parents 63c9fed4369e
children 9ce3b26798c4
comparison
equal deleted inserted replaced
206:63c9fed4369e 207:1bf0a5af2d5d
305 if (watchdog == 0) { 305 if (watchdog == 0) {
306 throw new HgBadStateException(String.format("Can't narrow down branch [%s, %s]", rb.head.shortNotation(), rb.root.shortNotation())); 306 throw new HgBadStateException(String.format("Can't narrow down branch [%s, %s]", rb.head.shortNotation(), rb.root.shortNotation()));
307 } 307 }
308 } 308 }
309 if (debug) { 309 if (debug) {
310 System.out.println("calculateMissingBranches:");
310 for (BranchChain bc : branches2load) { 311 for (BranchChain bc : branches2load) {
311 System.out.println("calculateMissingBranches:");
312 bc.dump(); 312 bc.dump();
313 } 313 }
314 } 314 }
315 return branches2load; 315 return branches2load;
316 } 316 }
454 de.entries = e.getValue(); 454 de.entries = e.getValue();
455 if (rootIndex == -1 && de.entries.size() == 1) { 455 if (rootIndex == -1 && de.entries.size() == 1) {
456 // returned sequence of length 1 means we used element from [head-2] as root 456 // returned sequence of length 1 means we used element from [head-2] as root
457 int numberOfElementsExcludingRootAndHead = de.headIndex + 1; 457 int numberOfElementsExcludingRootAndHead = de.headIndex + 1;
458 rootIndex = numberOfElementsExcludingRootAndHead + 1; 458 rootIndex = numberOfElementsExcludingRootAndHead + 1;
459 System.out.printf("On query %d found out exact number of missing elements: %d\n", totalQueries, numberOfElementsExcludingRootAndHead); 459 if (debug) {
460 System.out.printf("On query %d found out exact number of missing elements: %d\n", totalQueries, numberOfElementsExcludingRootAndHead);
461 }
460 } 462 }
461 datas.add(de); // queue up to record result and construct further requests 463 datas.add(de); // queue up to record result and construct further requests
462 } 464 }
463 betweenBatch.clear(); 465 betweenBatch.clear();
464 rangeToEntry.clear(); 466 rangeToEntry.clear();
477 System.out.printf("ERROR: element %d wasn't found\n",i); 479 System.out.printf("ERROR: element %d wasn't found\n",i);
478 resultOk = false; 480 resultOk = false;
479 } 481 }
480 fromRootToHead.addFirst(n); // reverse order 482 fromRootToHead.addFirst(n); // reverse order
481 } 483 }
482 System.out.println("Total queries:" + totalQueries); 484 if (debug) {
485 System.out.println("Total queries:" + totalQueries);
486 }
483 if (!resultOk) { 487 if (!resultOk) {
484 throw new HgBadStateException("See console for details"); // FIXME 488 throw new HgBadStateException("See console for details"); // FIXME
485 } 489 }
486 return fromRootToHead; 490 return fromRootToHead;
487 } 491 }