changeset 889:62ebe9e449a3

Move logging into mercurial command
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Fri, 07 Nov 2014 13:12:56 +0100
parents 207c4ec46d54
children 771ae1b2f0b1
files mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MercurialCommandLine.java
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java	Mon Nov 03 12:53:47 2014 +0100
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java	Fri Nov 07 13:12:56 2014 +0100
@@ -21,7 +21,6 @@
 import java.io.File;
 import java.util.Set;
 
-import static com.intellij.openapi.util.text.StringUtil.isEmpty;
 import static java.util.Collections.emptySet;
 
 /**
@@ -75,14 +74,11 @@
                                            @NotNull final CommandSettings commandSettings) throws VcsException {
 
     if (!myCommandSettings.getUseCommandlineViaFileWrapper()) {
-      String commandDescription = cli.getDescription();
-      if (!isEmpty(commandDescription))
-        commandSettings.getProgress().progressStarted(commandDescription);
+      cli.logCommandStarted(commandSettings.getProgress());
       try {
         return CommandUtil.runCommand(cli, commandSettings.setPrivateData(getPrivateData()));
       } finally {
-        if (!isEmpty(commandDescription))
-          commandSettings.getProgress().progressFinished(commandDescription + " finished");
+        cli.logCommandFinished(commandSettings.getProgress());
       }
     }
 
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MercurialCommandLine.java	Mon Nov 03 12:53:47 2014 +0100
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MercurialCommandLine.java	Fri Nov 07 13:12:56 2014 +0100
@@ -17,6 +17,7 @@
 package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;
 
 import com.intellij.execution.configurations.GeneralCommandLine;
+import jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialProgress;
 import jetbrains.buildServer.util.StringUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -24,6 +25,8 @@
 import java.nio.charset.Charset;
 import java.util.*;
 
+import static com.intellij.openapi.util.text.StringUtil.isEmpty;
+
 public class MercurialCommandLine {
   private String myExePath;
   private final List<String> myArguments = new ArrayList<String>();
@@ -170,4 +173,14 @@
   public void setDescription(@NotNull String description) {
     myDescription = description;
   }
+
+  public void logCommandStarted(@NotNull MercurialProgress progress) {
+    if (!isEmpty(myDescription))
+      progress.progressStarted(myDescription);
+  }
+
+  public void logCommandFinished(@NotNull MercurialProgress progress) {
+    if (!isEmpty(myDescription))
+      progress.progressFinished(myDescription);
+  }
 }