private String checkout(SvnOperationFactory svnOperationFactory) throws SVNException {
   logger.debug("Checking out " + getUri() + " to: " + getWorkingDirectory().getAbsolutePath());
   final SvnCheckout checkout = svnOperationFactory.createCheckout();
   checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(getUri())));
   checkout.setSingleTarget(SvnTarget.fromFile(getWorkingDirectory()));
   Long id = checkout.run();
   if (id == null) {
     return null;
   }
   return id.toString();
 }
  @NotNull
  private static SvnCheckout createCheckoutOperation(
      @NotNull SVNUpdateClient client, @NotNull WorkingCopyFormat format) {
    if (WorkingCopyFormat.ONE_DOT_SIX.equals(format)) {
      client.getOperationsFactory().setPrimaryWcGeneration(SvnWcGeneration.V16);
    }

    SvnCheckout checkoutOperation = client.getOperationsFactory().createCheckout();

    if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(format)) {
      checkoutOperation.setTargetWorkingCopyFormat(ISVNWCDb.WC_FORMAT_17);
    }

    return checkoutOperation;
  }
  /**
   * This is mostly inlined {@code SVNUpdateClient.doCheckout()} - to allow specifying necessary
   * working copy format. Otherwise, if only {@link SvnWcGeneration} is used - either svn 1.6 or svn
   * 1.8 working copy will be created.
   *
   * <p>See also http://issues.tmatesoft.com/issue/SVNKIT-495 for more details.
   */
  private static void runCheckout(
      @NotNull SVNUpdateClient client,
      @NotNull WorkingCopyFormat format,
      @NotNull SvnTarget source,
      @NotNull File destination,
      @Nullable SVNRevision revision,
      @Nullable Depth depth,
      boolean force)
      throws SVNException {
    SvnCheckout checkoutOperation = createCheckoutOperation(client, format);

    checkoutOperation.setUpdateLocksOnDemand(client.isUpdateLocksOnDemand());
    checkoutOperation.setSource(SvnTarget.fromURL(source.getURL(), source.getPegRevision()));
    checkoutOperation.setSingleTarget(SvnTarget.fromFile(destination));
    checkoutOperation.setRevision(revision);
    checkoutOperation.setDepth(toDepth(depth));
    checkoutOperation.setAllowUnversionedObstructions(force);
    checkoutOperation.setIgnoreExternals(client.isIgnoreExternals());
    checkoutOperation.setExternalsHandler(SvnCodec.externalsHandler(client.getExternalsHandler()));

    checkoutOperation.run();
  }