diff src/org/tmatesoft/hg/repo/HgRemoteRepository.java @ 295:981f9f50bb6c

Issue 11: Error log facility. SessionContext to share common facilities
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Sep 2011 05:35:32 +0200
parents 9fb50c04f03c
children dfb8405d996f
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRemoteRepository.java	Wed Sep 14 04:41:57 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRemoteRepository.java	Fri Sep 16 05:35:32 2011 +0200
@@ -48,8 +48,10 @@
 
 import org.tmatesoft.hg.core.HgBadArgumentException;
 import org.tmatesoft.hg.core.HgBadStateException;
+import org.tmatesoft.hg.core.HgInvalidFileException;
 import org.tmatesoft.hg.core.HgRemoteConnectionException;
 import org.tmatesoft.hg.core.Nodeid;
+import org.tmatesoft.hg.core.SessionContext;
 
 /**
  * WORK IN PROGRESS, DO NOT USE
@@ -66,12 +68,14 @@
 	private final String authInfo;
 	private final boolean debug = Boolean.parseBoolean(System.getProperty("hg4j.remote.debug"));
 	private HgLookup lookupHelper;
+	private final SessionContext sessionContext;
 
-	HgRemoteRepository(URL url) throws HgBadArgumentException {
-		if (url == null) {
+	HgRemoteRepository(SessionContext ctx, URL url) throws HgBadArgumentException {
+		if (url == null || ctx == null) {
 			throw new IllegalArgumentException();
 		}
 		this.url = url;
+		sessionContext = ctx;
 		if ("https".equals(url.getProtocol())) {
 			try {
 				sslContext = SSLContext.getInstance("SSL");
@@ -322,7 +326,7 @@
 	 * (there's no header like HG10?? with the server output, though, 
 	 * as one may expect according to http://mercurial.selenic.com/wiki/BundleFormat)
 	 */
-	public HgBundle getChanges(List<Nodeid> roots) throws HgRemoteConnectionException {
+	public HgBundle getChanges(List<Nodeid> roots) throws HgRemoteConnectionException, HgInvalidFileException {
 		List<Nodeid> _roots = roots.isEmpty() ? Collections.singletonList(Nodeid.NULL) : roots;
 		StringBuilder sb = new StringBuilder(20 + _roots.size() * 41);
 		sb.append("roots=");
@@ -361,7 +365,7 @@
 
 	private HgLookup getLookupHelper() {
 		if (lookupHelper == null) {
-			lookupHelper = new HgLookup();
+			lookupHelper = new HgLookup(sessionContext);
 		}
 		return lookupHelper;
 	}