@NotNull
  private List<WorkingCopyFormat> getSupportedFormats() {
    List<WorkingCopyFormat> result = ContainerUtil.newArrayList();
    ClientFactory factory = myVcs.getFactory();
    ClientFactory otherFactory = myVcs.getOtherFactory(factory);

    try {
      result.addAll(factory.createUpgradeClient().getSupportedFormats());
      result.addAll(SvnFormatWorker.getOtherFactoryFormats(otherFactory));
    } catch (VcsException e) {
      LOG.info(e);
    }

    return result;
  }
Ejemplo n.º 2
0
 public void conflictResolvedForFile(@NotNull VirtualFile file) {
   // TODO: Add possibility to resolve content conflicts separately from property conflicts.
   SvnVcs vcs = SvnVcs.getInstance(myProject);
   File path = new File(file.getPath());
   try {
     // TODO: Probably false should be passed to "resolveTree", but previous logic used true
     // implicitly
     vcs.getFactory(path).createConflictClient().resolve(path, Depth.EMPTY, false, true, true);
   } catch (VcsException e) {
     LOG.warn(e);
   }
   // the .mine/.r## files have been deleted
   final VirtualFile parent = file.getParent();
   if (parent != null) {
     parent.refresh(true, false);
   }
 }
  @Nullable
  public static SvnBranchConfigurationNew loadDefaultConfiguration(
      final Project project, final VirtualFile vcsRoot) {
    try {
      final SvnVcs vcs = SvnVcs.getInstance(project);

      File rootFile = new File(vcsRoot.getPath());
      final Info info = vcs.getInfo(rootFile);
      if (info == null || info.getURL() == null) {
        LOG.info("Directory is not a working copy: " + vcsRoot.getPresentableUrl());
        return null;
      }
      SVNURL baseUrl = info.getURL();

      final SvnBranchConfigurationNew result = new SvnBranchConfigurationNew();
      result.setTrunkUrl(baseUrl.toString());
      while (true) {
        final String s = SVNPathUtil.tail(baseUrl.getPath());
        if (s.equalsIgnoreCase(DEFAULT_TRUNK_NAME)
            || s.equalsIgnoreCase(DEFAULT_BRANCHES_NAME)
            || s.equalsIgnoreCase(DEFAULT_TAGS_NAME)) {
          SVNURL rootPath = baseUrl.removePathTail();
          SvnTarget target = SvnTarget.fromURL(rootPath);

          vcs.getFactory(target)
              .createBrowseClient()
              .list(target, SVNRevision.HEAD, Depth.IMMEDIATES, createHandler(result, rootPath));
          break;
        }
        if (SVNPathUtil.removeTail(baseUrl.getPath()).length() == 0) {
          break;
        }
        baseUrl = baseUrl.removePathTail();
      }
      return result;
    } catch (SVNException e) {
      LOG.info(e);
      return null;
    } catch (VcsException e) {
      LOG.info(e);
      return null;
    }
  }
Ejemplo n.º 4
0
  public boolean isBinary(@NotNull final VirtualFile file) {
    SvnVcs vcs = SvnVcs.getInstance(myProject);

    try {
      File ioFile = new File(file.getPath());
      PropertyClient client = vcs.getFactory(ioFile).createPropertyClient();

      PropertyValue value =
          client.getProperty(
              SvnTarget.fromFile(ioFile),
              SvnPropertyKeys.SVN_MIME_TYPE,
              false,
              SVNRevision.WORKING);
      if (value != null && isBinaryMimeType(value.toString())) {
        return true;
      }
    } catch (VcsException e) {
      LOG.warn(e);
    }

    return false;
  }
Ejemplo n.º 5
0
  public void mergeNext() throws SVNException, VcsException {
    myAtStart = false;

    File destination = new File(myTargetPath);
    MergeClient client = myVcs.getFactory(destination).createMergeClient();

    if (myReintegrate) {
      client.merge(
          SvnTarget.fromURL(mySourceUrl), destination, false, createDiffOptions(), myHandler);
    } else {
      client.merge(
          SvnTarget.fromURL(mySourceUrl, SVNRevision.create(mySourceCopyRevision)),
          SvnTarget.fromURL(mySourceUrl, SVNRevision.create(mySourceLatestRevision)),
          destination,
          SVNDepth.INFINITY,
          true,
          false,
          false,
          true,
          createDiffOptions(),
          myHandler);
    }
  }