public static HgCommandResult ensureSuccess(@Nullable HgCommandResult result) throws VcsException {
    if (result == null) {
      throw new VcsException(HgBundle.message("error.cannot.execute.command"));
    }
    // workaround for mercurial: trying to merge with ancestor is not important/fatal error but natively hg produces abort error.
    if (fatalErrorOccurred(result) && !isAncestorMergeError(result)) {
      throw new VcsException(result.getRawError());
    }
    return result;
  }
public static HgCommandResult ensureSuccess(@Nullable HgCommandResult result)