コード例 #1
0
  @Override
  public void merge(
      @NotNull SvnTarget source1,
      @NotNull SvnTarget source2,
      @NotNull File destination,
      @Nullable Depth depth,
      boolean useAncestry,
      boolean dryRun,
      boolean recordOnly,
      boolean force,
      @Nullable DiffOptions diffOptions,
      @Nullable ProgressTracker handler)
      throws VcsException {
    assertUrl(source1);
    assertUrl(source2);

    List<String> parameters = new ArrayList<String>();

    CommandUtil.put(parameters, source1);
    CommandUtil.put(parameters, source2);
    fillParameters(parameters, destination, depth, dryRun, recordOnly, force, false, diffOptions);
    CommandUtil.put(parameters, !useAncestry, "--ignore-ancestry");

    run(destination, handler, parameters);
  }
コード例 #2
0
  private static List<String> prepareParameters(File[] paths, SVNDepth depth) {
    ArrayList<String> parameters = new ArrayList<String>();

    CommandUtil.put(parameters, paths);
    CommandUtil.put(parameters, depth);

    return parameters;
  }
コード例 #3
0
  private void run(File destination, ProgressTracker handler, List<String> parameters)
      throws VcsException {
    BaseUpdateCommandListener listener =
        new BaseUpdateCommandListener(CommandUtil.correctUpToExistingParent(destination), handler);

    execute(myVcs, SvnTarget.fromFile(destination), SvnCommandName.merge, parameters, listener);

    listener.throwWrappedIfException();
  }
コード例 #4
0
  // TODO: Add possibility to resolve content, property and tree conflicts separately.
  // TODO: Or rewrite logic to have one "Resolve conflicts" action instead of separate actions for
  // each conflict type.
  @Override
  public void resolve(
      @NotNull File path,
      @Nullable Depth depth,
      boolean resolveProperty,
      boolean resolveContent,
      boolean resolveTree)
      throws VcsException {
    List<String> parameters = new ArrayList<String>();

    CommandUtil.put(parameters, path);
    CommandUtil.put(parameters, depth);
    parameters.add("--accept");
    parameters.add("working");

    // for now parsing of the output is not required as command is executed only for one file
    // and will be either successful or exception will be thrown
    execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.resolve, parameters, null);
  }
コード例 #5
0
  @Override
  public void export(
      @NotNull SvnTarget from,
      @NotNull File to,
      @Nullable SVNRevision revision,
      @Nullable Depth depth,
      @Nullable String nativeLineEnd,
      boolean force,
      boolean ignoreExternals,
      @Nullable ProgressTracker handler)
      throws VcsException {
    List<String> parameters = new ArrayList<String>();

    CommandUtil.put(parameters, from);
    CommandUtil.put(parameters, to);
    CommandUtil.put(parameters, revision);
    CommandUtil.put(parameters, depth);
    CommandUtil.put(parameters, force, "--force");
    CommandUtil.put(parameters, ignoreExternals, "--ignore-externals");
    if (!StringUtil.isEmpty(nativeLineEnd)) {
      parameters.add("--native-eol");
      parameters.add(nativeLineEnd);
    }

    BaseUpdateCommandListener listener = new BaseUpdateCommandListener(to, handler);

    execute(myVcs, from, to, SvnCommandName.export, parameters, listener);

    listener.throwWrappedIfException();
  }
コード例 #6
0
  @Override
  public void merge(
      @NotNull SvnTarget source,
      @NotNull File destination,
      boolean dryRun,
      @Nullable DiffOptions diffOptions,
      @Nullable final ProgressTracker handler)
      throws VcsException {
    assertUrl(source);

    List<String> parameters = new ArrayList<String>();
    CommandUtil.put(parameters, source);
    fillParameters(parameters, destination, null, dryRun, false, false, true, diffOptions);

    run(destination, handler, parameters);
  }
コード例 #7
0
  @Override
  public void merge(
      @NotNull SvnTarget source,
      @NotNull SVNRevisionRange range,
      @NotNull File destination,
      @Nullable Depth depth,
      boolean dryRun,
      boolean recordOnly,
      boolean force,
      @Nullable DiffOptions diffOptions,
      @Nullable ProgressTracker handler)
      throws VcsException {
    assertUrl(source);

    List<String> parameters = new ArrayList<String>();

    parameters.add("--revision");
    parameters.add(range.getStartRevision() + ":" + range.getEndRevision());
    CommandUtil.put(parameters, source);
    fillParameters(parameters, destination, depth, dryRun, recordOnly, force, false, diffOptions);

    run(destination, handler, parameters);
  }
コード例 #8
0
  private static void fillParameters(
      @NotNull List<String> parameters,
      @NotNull File destination,
      @Nullable Depth depth,
      boolean dryRun,
      boolean recordOnly,
      boolean force,
      boolean reintegrate,
      @Nullable DiffOptions diffOptions) {
    CommandUtil.put(parameters, destination);
    CommandUtil.put(parameters, diffOptions);
    CommandUtil.put(parameters, dryRun, "--dry-run");

    CommandUtil.put(parameters, depth);
    CommandUtil.put(parameters, force, "--force");
    CommandUtil.put(parameters, recordOnly, "--record-only");

    parameters.add("--accept");
    parameters.add("postpone");
    // deprecated for 1.8, but should be specified for previous clients
    CommandUtil.put(parameters, reintegrate, "--reintegrate");
  }
コード例 #9
0
  @Override
  public void revert(
      @NotNull File[] paths, @Nullable SVNDepth depth, @Nullable ISVNEventHandler handler)
      throws VcsException {
    if (paths.length > 0) {
      List<String> parameters = prepareParameters(paths, depth);

      // TODO: handler should be called in parallel with command execution, but this will be in
      // other thread
      // TODO: check if that is ok for current handler implementation
      // TODO: add possibility to invoke "handler.checkCancelled" - process should be killed
      CommandExecutor command =
          execute(
              myVcs,
              SvnTarget.fromFile(paths[0]),
              CommandUtil.getHomeDirectory(),
              SvnCommandName.revert,
              parameters,
              null);
      FileStatusResultParser parser =
          new FileStatusResultParser(CHANGED_PATH, handler, new RevertStatusConvertor());
      parser.parse(command.getOutput());
    }
  }