changeset 763:d34bfe6e662d

rename
author eugene.petrenko@jetbrains.com
date Tue, 25 Feb 2014 11:59:31 +0100
parents 7bf456c8db53
children 75b5b9f0fc6d
files mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialClasspathTemplate.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialLogTemplate.java mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/RepoFactory.java mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/LogCommandTest.java
diffstat 4 files changed, 71 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialClasspathTemplate.java	Tue Feb 25 11:59:31 2014 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package jetbrains.buildServer.buildTriggers.vcs.mercurial;
+
+import jetbrains.buildServer.util.FileUtil;
+import jetbrains.buildServer.vcs.VcsException;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.io.IOException;
+
+import static com.intellij.openapi.util.io.FileUtil.createTempFile;
+import static com.intellij.openapi.util.io.FileUtil.delete;
+
+/**
+* Created 25.02.14 11:29
+*
+* @author Eugene Petrenko (eugene.petrenko@jetbrains.com)
+*/
+public class MercurialClasspathTemplate implements MercurialTemplate {
+  private final String myResourcePath;
+  private final String myTmpFileSuffix;
+
+  public MercurialClasspathTemplate(@NotNull final String resourcePath,
+                                    @NotNull final String tmpFileSuffix) throws IOException {
+    myResourcePath = resourcePath;
+    myTmpFileSuffix = tmpFileSuffix;
+  }
+
+  @NotNull
+  public <T> T withTemplate(@NotNull final WithTemplate<T> action) throws VcsException {
+    //TODO: we may pack plugin and use jetbrains.buildServer.web.openapi.PluginDescriptor.getPluginRoot()
+    //TODO: to get path to existing file
+    final File template = copyTemplate();
+    try {
+      return action.action(template);
+    } finally {
+      delete(template);
+    }
+  }
+
+  private File copyTemplate() throws VcsException {
+    try {
+      final File template = createTempFile("teamcity", myTmpFileSuffix);
+      FileUtil.copyResource(getClass(), myResourcePath, template);
+      return template;
+    } catch (IOException e) {
+      throw new VcsException("Cannot create mercurial log template", e);
+    }
+  }
+}
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialLogTemplate.java	Tue Feb 25 11:58:12 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package jetbrains.buildServer.buildTriggers.vcs.mercurial;
-
-import jetbrains.buildServer.util.FileUtil;
-import jetbrains.buildServer.vcs.VcsException;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.IOException;
-
-import static com.intellij.openapi.util.io.FileUtil.createTempFile;
-import static com.intellij.openapi.util.io.FileUtil.delete;
-
-/**
-* Created 25.02.14 11:29
-*
-* @author Eugene Petrenko (eugene.petrenko@jetbrains.com)
-*/
-public class MercurialLogTemplate implements MercurialTemplate {
-  private final String myResourcePath;
-  private final String myTmpFileSuffix;
-
-  public MercurialLogTemplate(@NotNull final String resourcePath,
-                              @NotNull final String tmpFileSuffix) throws IOException {
-    myResourcePath = resourcePath;
-    myTmpFileSuffix = tmpFileSuffix;
-  }
-
-  @NotNull
-  public <T> T withTemplate(@NotNull final WithTemplate<T> action) throws VcsException {
-    //TODO: we may pack plugin and use jetbrains.buildServer.web.openapi.PluginDescriptor.getPluginRoot()
-    //TODO: to get path to existing file
-    final File template = copyTemplate();
-    try {
-      return action.action(template);
-    } finally {
-      delete(template);
-    }
-  }
-
-  private File copyTemplate() throws VcsException {
-    try {
-      final File template = createTempFile("teamcity", myTmpFileSuffix);
-      FileUtil.copyResource(getClass(), myResourcePath, template);
-      return template;
-    } catch (IOException e) {
-      throw new VcsException("Cannot create mercurial log template", e);
-    }
-  }
-}
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/RepoFactory.java	Tue Feb 25 11:58:12 2014 +0100
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/RepoFactory.java	Tue Feb 25 11:59:31 2014 +0100
@@ -34,10 +34,10 @@
   protected final CommandSettingsFactory myCommandSettingsFactory;
   protected final HgPathProvider myHgPathProvider;
 
-  protected final MercurialLogTemplate myLogTemplate = new MercurialLogTemplate("/buildServerResources/log.template", "hg.log.template");
-  protected final MercurialLogTemplate myLogNoFilesTemplate = new MercurialLogTemplate("/buildServerResources/log.no.files.template", "hg.short.log.template");
-  protected final MercurialLogTemplate myDagTemplate = new MercurialLogTemplate("/buildServerResources/dag.template", "hg.dag.template");
-  protected final MercurialLogTemplate myFastLogTemplate = new MercurialLogTemplate("/buildServerResources/fastlog.template", "hg.fastlog.template");
+  protected final MercurialClasspathTemplate myLogTemplate = new MercurialClasspathTemplate("/buildServerResources/log.template", "hg.log.template");
+  protected final MercurialClasspathTemplate myLogNoFilesTemplate = new MercurialClasspathTemplate("/buildServerResources/log.no.files.template", "hg.short.log.template");
+  protected final MercurialClasspathTemplate myDagTemplate = new MercurialClasspathTemplate("/buildServerResources/dag.template", "hg.dag.template");
+  protected final MercurialClasspathTemplate myFastLogTemplate = new MercurialClasspathTemplate("/buildServerResources/fastlog.template", "hg.fastlog.template");
 
   public RepoFactory(@NotNull ServerPluginConfig config,
                      @NotNull CommandSettingsFactory commandSettingsFactory,
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/LogCommandTest.java	Tue Feb 25 11:58:12 2014 +0100
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/LogCommandTest.java	Tue Feb 25 11:59:31 2014 +0100
@@ -17,7 +17,7 @@
 
 import jetbrains.buildServer.TempFiles;
 import jetbrains.buildServer.buildTriggers.vcs.mercurial.HgPathProvider;
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialLogTemplate;
+import jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialClasspathTemplate;
 import jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialTemplate;
 import jetbrains.buildServer.vcs.VcsException;
 import org.jetbrains.annotations.NotNull;
@@ -43,7 +43,7 @@
   protected void setUp() throws Exception {
     super.setUp();
     setRepository("mercurial-tests/testData/rep1", true);
-    myTemplateFile = new MercurialLogTemplate("/buildServerResources/log.template", "log.template") {};
+    myTemplateFile = new MercurialClasspathTemplate("/buildServerResources/log.template", "log.template") {};
   }