boolean (@Nullable HgCommandResult result) { if (result == null) { return false; } // error messages from mercurial after update command failed: "abort: outstanding uncommitted merges", "abort: uncommitted changes"; //after revert command failed: abort: "uncommitted merge" final Pattern UNCOMMITTED_PATTERN = Pattern.compile(".*abort.*uncommitted\\s*(change|merge).*", Pattern.DOTALL); Matcher matcher = UNCOMMITTED_PATTERN.matcher(result.getRawError()); return matcher.matches(); }