Commits

John Peberdy committed f968739

Comments (0)

Files changed (3)

src/main/java/com/aragost/javahg/commands/PullCommand.java

             cmdAppend(source);
         }
         // TODO: handle pushing multiple heads
-        return PullPushHelper.parseStream(getRepository(), launchStream());
+        return PullPushHelper.parseStream(this, launchStream());
     }
 
     /**

src/main/java/com/aragost/javahg/commands/PushCommand.java

         if (destination != null) {
             cmdAppend(destination);
         }
-        return PullPushHelper.parseStream(getRepository(), launchStream());
+        return PullPushHelper.parseStream(this, launchStream());
     }
 
     /**

src/main/java/com/aragost/javahg/internals/PullPushHelper.java

 
 import com.aragost.javahg.Changeset;
 import com.aragost.javahg.Repository;
+import com.aragost.javahg.commands.ExecutionException;
 import com.aragost.javahg.commands.LogCommand;
 import com.google.common.collect.Lists;
 import com.google.common.io.ByteStreams;
     private static final byte[] BEGIN_FALLBACK = "adding changesets\n"
             .getBytes();
     private static final byte[] LINE_BEGIN = "add changeset ".getBytes();
+    private static final byte[] REMOTE_ERROR = "remote: error: ".getBytes();
 
-    public static List<Changeset> parseStream(Repository repo,
+    public static List<Changeset> parseStream(AbstractCommand command,
             HgInputStream stream) throws IOException {
+    	Repository repo = command.getRepository();
         List<Changeset> result;
 
         // Pulling locally the full nodes are written after
             }
         }
 
+        stream = new HgInputStream(new ByteArrayInputStream(bos.toByteArray()), repo.newDecoder());
+
+        if (stream.find(REMOTE_ERROR)) {
+            throw new ExecutionException(command, stream.textUpTo('\n'));
+        }
+
         return result;
     }
 }