diff src/org/tmatesoft/hg/core/HgCloneCommand.java @ 490:b3c16d1aede0

Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 16 Aug 2012 17:08:34 +0200
parents 12f668401613
children 10ca3ede8367
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgCloneCommand.java	Mon Aug 13 19:24:29 2012 +0200
+++ b/src/org/tmatesoft/hg/core/HgCloneCommand.java	Thu Aug 16 17:08:34 2012 +0200
@@ -30,11 +30,10 @@
 import java.util.TreeMap;
 import java.util.zip.DeflaterOutputStream;
 
-import org.tmatesoft.hg.internal.BasicSessionContext;
 import org.tmatesoft.hg.internal.ByteArrayDataAccess;
 import org.tmatesoft.hg.internal.DataAccess;
 import org.tmatesoft.hg.internal.DigestHelper;
-import org.tmatesoft.hg.internal.Internals;
+import org.tmatesoft.hg.internal.RepoInitializer;
 import org.tmatesoft.hg.repo.HgBundle;
 import org.tmatesoft.hg.repo.HgBundle.GroupElement;
 import org.tmatesoft.hg.repo.HgInvalidControlFileException;
@@ -108,7 +107,7 @@
 		// pull all changes from the very beginning
 		// XXX consult getContext() if by any chance has a bundle ready, if not, then read and register 
 		HgBundle completeChanges = srcRepo.getChanges(Collections.singletonList(NULL));
-		WriteDownMate mate = new WriteDownMate(destination);
+		WriteDownMate mate = new WriteDownMate(srcRepo.getSessionContext(), destination);
 		try {
 			// instantiate new repo in the destdir
 			mate.initEmptyRepository();
@@ -143,17 +142,17 @@
 		private final ArrayList<Nodeid> revisionSequence = new ArrayList<Nodeid>(); // last visited nodes first
 
 		private final LinkedList<String> fncacheFiles = new LinkedList<String>();
-		private Internals implHelper;
+		private RepoInitializer repoInit;
 
-		public WriteDownMate(File destDir) {
+		public WriteDownMate(SessionContext ctx, File destDir) {
 			hgDir = new File(destDir, ".hg");
-			implHelper = new Internals(new BasicSessionContext(null));
-			implHelper.setStorageConfig(1, STORE | FNCACHE | DOTENCODE);
-			storagePathHelper = implHelper.buildDataFilesHelper();
+			repoInit = new RepoInitializer();
+			repoInit.setRequires(STORE | FNCACHE | DOTENCODE);
+			storagePathHelper = repoInit.buildDataFilesHelper(ctx);
 		}
 
 		public void initEmptyRepository() throws IOException {
-			implHelper.initEmptyRepository(hgDir);
+			repoInit.initEmptyRepository(hgDir);
 		}
 
 		public void complete() throws IOException {