changeset 855:dbb5464363d9

Detect unknown mercurial exceptions
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Tue, 08 Jul 2014 12:08:44 +0200
parents 3a418ac5ada1
children a11bcfb63f4f
files mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandResult.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/exception/UnknownMercurialException.java
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandResult.java	Tue Jul 08 10:05:08 2014 +0200
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandResult.java	Tue Jul 08 12:08:44 2014 +0200
@@ -212,6 +212,7 @@
     checkAbandonedTransaction(stderr);
     checkMergeWithWorkDirAncestor(stderr);
     checkNothingToMerge(stderr);
+    checkUnknownException(stderr);
   }
 
   private void checkUnrelatedRepository(@NotNull final String stderr) throws UnrelatedRepositoryException {
@@ -263,6 +264,11 @@
       throw new NothingToMergeException();
   }
 
+  private void checkUnknownException(@NotNull final String stderr) throws UnknownMercurialException {
+    if (stderr.contains("unknown exception encountered"))
+      throw new UnknownMercurialException(stderr);
+  }
+
   private static Set<Integer> setOf(Integer... ints) {
     return new HashSet<Integer>(asList(ints));
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/exception/UnknownMercurialException.java	Tue Jul 08 12:08:44 2014 +0200
@@ -0,0 +1,26 @@
+/*
+ * 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.command.exception;
+
+import jetbrains.buildServer.vcs.VcsException;
+import org.jetbrains.annotations.NotNull;
+
+public class UnknownMercurialException extends VcsException {
+  public UnknownMercurialException(@NotNull String stderr) {
+    super(stderr);
+  }
+}