changeset 207:1bf0a5af2d5d

Conditional debug printouts
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 28 Apr 2011 03:10:56 +0200
parents 63c9fed4369e
children ef8eba4aa215
files src/org/tmatesoft/hg/internal/RepositoryComparator.java src/org/tmatesoft/hg/repo/HgRemoteRepository.java
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RepositoryComparator.java	Thu Apr 28 02:47:44 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/RepositoryComparator.java	Thu Apr 28 03:10:56 2011 +0200
@@ -307,8 +307,8 @@
 			}
 		}
 		if (debug) {
+			System.out.println("calculateMissingBranches:");
 			for (BranchChain bc : branches2load) {
-				System.out.println("calculateMissingBranches:");
 				bc.dump();
 			}
 		}
@@ -456,7 +456,9 @@
 						// returned sequence of length 1 means we used element from [head-2] as root
 						int numberOfElementsExcludingRootAndHead = de.headIndex + 1;
 						rootIndex = numberOfElementsExcludingRootAndHead + 1;
-						System.out.printf("On query %d found out exact number of missing elements: %d\n", totalQueries, numberOfElementsExcludingRootAndHead);
+						if (debug) {
+							System.out.printf("On query %d found out exact number of missing elements: %d\n", totalQueries, numberOfElementsExcludingRootAndHead);
+						}
 					}
 					datas.add(de); // queue up to record result and construct further requests
 				}
@@ -479,7 +481,9 @@
 			}
 			fromRootToHead.addFirst(n); // reverse order
 		}
-		System.out.println("Total queries:" + totalQueries);
+		if (debug) {
+			System.out.println("Total queries:" + totalQueries);
+		}
 		if (!resultOk) {
 			throw new HgBadStateException("See console for details"); // FIXME
 		}
--- a/src/org/tmatesoft/hg/repo/HgRemoteRepository.java	Thu Apr 28 02:47:44 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRemoteRepository.java	Thu Apr 28 03:10:56 2011 +0200
@@ -77,10 +77,14 @@
 				sslContext = SSLContext.getInstance("SSL");
 				class TrustEveryone implements X509TrustManager {
 					public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
-						System.out.println("checkClientTrusted " + authType);
+						if (debug) {
+							System.out.println("checkClientTrusted:" + authType);
+						}
 					}
 					public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
-						System.out.println("checkServerTrusted" + authType);
+						if (debug) {
+							System.out.println("checkServerTrusted:" + authType);
+						}
 					}
 					public X509Certificate[] getAcceptedIssuers() {
 						return new X509Certificate[0];