Mercurial > hg > mercurial
changeset 423:010d8663ac4d
TW-21384 better error message
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Thu, 10 May 2012 15:10:35 +0400 |
parents | ef53ca83df1b |
children | 3239780e4e8f |
files | mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandResult.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/exception/UnrelatedRepositoryException.java |
diffstat | 3 files changed, 22 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java Sat Apr 28 13:14:16 2012 +0400 +++ b/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java Thu May 10 15:10:35 2012 +0400 @@ -5,6 +5,7 @@ import jetbrains.buildServer.agent.vcs.IncludeRuleUpdater; import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.AuthSettings; import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.Settings; +import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.exception.UnrelatedRepositoryException; import jetbrains.buildServer.vcs.IncludeRule; import jetbrains.buildServer.vcs.VcsException; import jetbrains.buildServer.vcs.VcsRoot; @@ -114,9 +115,13 @@ myLogger.message("Repository already contains revision " + myToVersion); } else { myLogger.message("Start pulling changes from " + (myUseLocalMirrors ? "local mirror " : "") + myAuthSettings.getRepositoryUrlWithHiddenPassword(repositoryUrl)); - repo.pull().fromRepository(repositoryUrl) - .withTimeout(myPullTimeout) - .call(); + try { + repo.pull().fromRepository(repositoryUrl) + .withTimeout(myPullTimeout) + .call(); + } catch (UnrelatedRepositoryException e) { + throw new UnrelatedRepositoryException(myAuthSettings.getRepositoryUrlWithHiddenPassword(repositoryUrl), workingDir); + } myLogger.message("Changes successfully pulled"); } }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandResult.java Sat Apr 28 13:14:16 2012 +0400 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandResult.java Thu May 10 15:10:35 2012 +0400 @@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -39,11 +38,10 @@ private final ExecResult myDelegate; private final Set<String> myPrivateData; - public CommandResult(@NotNull Logger logger, @NotNull String command, @NotNull ExecResult execResult) { - this(logger, command, execResult, Collections.<String>emptySet()); - } - - public CommandResult(@NotNull Logger logger, @NotNull String command, @NotNull ExecResult execResult, @NotNull Set<String> privateData) { + public CommandResult(@NotNull Logger logger, + @NotNull String command, + @NotNull ExecResult execResult, + @NotNull Set<String> privateData) { myLogger = logger; myCommand = command; myDelegate = execResult;
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/exception/UnrelatedRepositoryException.java Sat Apr 28 13:14:16 2012 +0400 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/exception/UnrelatedRepositoryException.java Thu May 10 15:10:35 2012 +0400 @@ -1,10 +1,20 @@ package jetbrains.buildServer.buildTriggers.vcs.mercurial.command.exception; import jetbrains.buildServer.vcs.VcsException; +import org.jetbrains.annotations.NotNull; + +import java.io.File; /** * @author dmitry.neverov */ public class UnrelatedRepositoryException extends VcsException { + public UnrelatedRepositoryException() { + super("Repository is unrelated"); + } + + public UnrelatedRepositoryException(@NotNull String repositoryUrl, @NotNull File workingDir) { + super("Repository " + repositoryUrl + " is unrelated to the repository in " + workingDir.getAbsolutePath()); + } }