changeset 771:06dcc79b304d

use API only
author eugene.petrenko@jetbrains.com
date Tue, 25 Feb 2014 12:36:10 +0100
parents 5abd4de360e8
children 270e28fe1895
files mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/RepoFactory.java mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java
diffstat 3 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/RepoFactory.java	Tue Feb 25 12:28:53 2014 +0100
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/RepoFactory.java	Tue Feb 25 12:36:10 2014 +0100
@@ -44,15 +44,17 @@
   }
 
   @NotNull
-  public ServerHgRepo create(@NotNull File workingDir,
-                             @NotNull String hgPath,
-                             @NotNull AuthSettings authSettings) throws VcsException {
-    return new ServerHgRepo(myCommandSettingsFactory, myConfig, workingDir, hgPath, authSettings);
+  protected ServerHgRepo create(@NotNull File workingDir,
+                                @NotNull String hgPath,
+                                @NotNull AuthSettings authSettings,
+                                @NotNull CommandSettingsFactory commandSettingsFactory,
+                                @NotNull ServerPluginConfig config) {
+    return new ServerHgRepo(commandSettingsFactory, config, workingDir, hgPath, authSettings);
   }
 
   @NotNull
   public ServerHgRepo createRepo(@NotNull HgVcsRoot root, @NotNull File workingDir) throws VcsException {
-    return create(workingDir, myHgPathProvider.getHgPath(root), root.getAuthSettings());
+    return create(workingDir, myHgPathProvider.getHgPath(root), root.getAuthSettings(), myCommandSettingsFactory, myConfig);
   }
 
   public void dispose() {
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Tue Feb 25 12:28:53 2014 +0100
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Tue Feb 25 12:36:10 2014 +0100
@@ -581,8 +581,6 @@
     if (!SystemInfo.isUnix)
       return;
 
-    RepoFactory repoFactory = new RepoFactory(myPluginConfig, new TestCommandSettingsFactory(), myHgPathProvider);
-
     //create a file on the server
     File dirOnTheServer = myTempFiles.createTempDir();
     File fileOnTheServer = new File(dirOnTheServer, "file.on.server");
@@ -590,7 +588,7 @@
 
     //create a remote repository with symlink pointing to the file on the server
     File repository = copyRepository(myTempFiles, simpleRepo());
-    ServerHgRepo repo = repoFactory.create(repository, getHgPath(), new AuthSettings());
+    ServerHgRepo repo = new ServerHgRepo(new TestCommandSettingsFactory(), myPluginConfig, repository, getHgPath(), new AuthSettings());
     repo.update().toRevision("9c6a6b4aede0").call();
     new ProcessBuilder("ln", "-s", dirOnTheServer.getCanonicalPath()).directory(repository).start().waitFor();
     new ProcessBuilder(getHgPath(), "add", dirOnTheServer.getName()).directory(repository).start().waitFor();
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java	Tue Feb 25 12:28:53 2014 +0100
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java	Tue Feb 25 12:36:10 2014 +0100
@@ -16,10 +16,7 @@
 
 package jetbrains.buildServer.buildTriggers.vcs.mercurial;
 
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.AuthSettings;
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CatCommand;
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CommandSettingsFactory;
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.TestCommandSettingsFactory;
+import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.*;
 import jetbrains.buildServer.vcs.*;
 import org.jetbrains.annotations.NotNull;
 import org.testng.annotations.BeforeMethod;
@@ -233,8 +230,8 @@
     RepoFactory repoFactory = new RepoFactory(pluginConfig, new TestCommandSettingsFactory(), myHgPathProvider) {
       @NotNull
       @Override
-      public ServerHgRepo create(@NotNull File workingDir, @NotNull String hgPath, @NotNull AuthSettings authSettings) throws VcsException {
-        return new CountingServerHgRepo(myCommandSettingsFactory, myConfig, workingDir, hgPath, authSettings, catCallCounter);
+      protected ServerHgRepo create(@NotNull File workingDir, @NotNull String hgPath, @NotNull AuthSettings authSettings, @NotNull CommandSettingsFactory commandSettingsFactory, @NotNull ServerPluginConfig config) {
+        return new CountingServerHgRepo(commandSettingsFactory, config, workingDir, hgPath, authSettings, catCallCounter);
       }
     };