Пример #1
0
  @Override
  public void execute(final SmtpMessage message) throws IOException {
    final SVNWCClient svnWCClient = svnClientManager.getWCClient();

    try {
      final SVNPropertyData svnPropData =
          svnWCClient.doGetProperty(
              svnRepositoryURL,
              propName,
              SVNRevision.create(revision),
              SVNRevision.create(revision));

      LOG.info(
          "PROPCHANGE: getName()="
              + svnPropData.getName()
              + " getValue()="
              + svnPropData.getValue());
      System.out.println(svnPropData.getName() + ":" + svnPropData.getValue());

      // TODO write the prop change to the OutputStream

      // TODO dont forget old prop value
    } catch (final SVNException se) {
      throw new IOException("SVN communication error: " + se.getMessage(), se);
    }
  }
  private static String getPropertyList(
      final ContentRevision contentRevision, final SVNRevision revision, final SVNWCClient client)
      throws SVNException {
    if (contentRevision == null) {
      return "";
    }

    final StringBuilder sb = new StringBuilder();
    final List<SVNPropertyData> lines = new ArrayList<SVNPropertyData>();

    final File ioFile = contentRevision.getFile().getIOFile();
    final ISVNPropertyHandler propertyHandler = createHandler(revision, lines);

    if (contentRevision instanceof SvnRepositoryContentRevision) {
      final SvnRepositoryContentRevision svnRevision =
          (SvnRepositoryContentRevision) contentRevision;
      client.doGetProperty(
          SVNURL.parseURIEncoded(svnRevision.getFullPath()),
          null,
          revision,
          revision,
          SVNDepth.EMPTY,
          propertyHandler);
    } else {
      client.doGetProperty(ioFile, null, revision, revision, SVNDepth.EMPTY, propertyHandler, null);
    }

    Collections.sort(
        lines,
        new Comparator<SVNPropertyData>() {
          public int compare(final SVNPropertyData o1, final SVNPropertyData o2) {
            return o1.getName().compareTo(o2.getName());
          }
        });
    for (SVNPropertyData line : lines) {
      addPropertyPresentation(line, sb);
    }
    return sb.toString();
  }
  public static String getPropertyList(
      final File ioFile, final SVNRevision revision, final SVNWCClient client) throws SVNException {
    final StringBuilder sb = new StringBuilder();
    final List<SVNPropertyData> lines = new ArrayList<SVNPropertyData>();

    final ISVNPropertyHandler propertyHandler = createHandler(revision, lines);

    client.doGetProperty(ioFile, null, revision, revision, SVNDepth.EMPTY, propertyHandler, null);

    Collections.sort(
        lines,
        new Comparator<SVNPropertyData>() {
          public int compare(final SVNPropertyData o1, final SVNPropertyData o2) {
            return o1.getName().compareTo(o2.getName());
          }
        });
    for (SVNPropertyData line : lines) {
      addPropertyPresentation(line, sb);
    }

    return sb.toString();
  }
Пример #4
0
  @Test
  public void testSimpleMerged() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);

    final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
    trunk.mkdir();
    Thread.sleep(100);
    final File folder = new File(trunk, "folder");
    folder.mkdir();
    Thread.sleep(100);
    final File f1 = new File(folder, "f1.txt");
    f1.createNewFile();
    new File(folder, "f2.txt").createNewFile();
    Thread.sleep(100);

    verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"));
    verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"));

    FileUtil.delete(trunk);
    verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()));
    verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()));

    // rev 3
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1);
    editFileInCommand(myProject, vf, "123\n456\n123");
    Thread.sleep(100);
    verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath()));

    // rev 4: record as merged into branch
    verify(
        runSvn(
            "merge",
            "-c",
            "3",
            myRepoUrl + "/trunk",
            myBranchVcsRoot.getAbsolutePath(),
            "--record-only"));
    Thread.sleep(100);
    verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()));

    Thread.sleep(100);
    verify(runSvn("up", myBranchVcsRoot.getAbsolutePath()));

    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    final SVNWCClient wcClient = vcs.createWCClient();
    final SVNPropertyData data =
        wcClient.doGetProperty(
            myBranchVcsRoot, "svn:mergeinfo", SVNRevision.UNDEFINED, SVNRevision.WORKING);
    assert data != null
        && data.getValue() != null
        && "/trunk:3".equals(data.getValue().getString());

    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider =
        vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList =
        committedChangesProvider.getCommittedChanges(
            committedChangesProvider.createDefaultSettings(),
            new SvnRepositoryLocation(myRepoUrl + "/trunk"),
            0);

    final SvnChangeList changeList = changeListList.get(0);
    final String encodedRepoUrl = SVNURL.parseURIDecoded(myRepoUrl).toString();
    final BranchInfo branchInfo =
        new BranchInfo(
            vcs,
            encodedRepoUrl,
            encodedRepoUrl + "/branch",
            encodedRepoUrl + "/trunk",
            encodedRepoUrl + "/trunk",
            vcs.createWCClient());
    final SvnMergeInfoCache.MergeCheckResult result =
        branchInfo.checkList(changeList, myBranchVcsRoot.getAbsolutePath());
    assert SvnMergeInfoCache.MergeCheckResult.MERGED.equals(result);
  }