public SVNWCClient createWCClient() {
   final SVNWCClient client = new SVNWCClient(getPool(), myConfiguration.getOptions(myProject));
   client
       .getOperationsFactory()
       .setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
   return client;
 }
    @Override
    protected void preliminary() throws SVNException {
      SVNWCClient wcClient = myVcs.createWCClient();
      myInfo =
          wcClient.doInfo(new File(myFile.getIOFile().getAbsolutePath()), SVNRevision.UNDEFINED);
      wcClient.setEventHandler(
          new ISVNEventHandler() {
            public void handleEvent(SVNEvent event, double progress) throws SVNException {}

            public void checkCancelled() throws SVNCancelException {
              myPI.checkCanceled();
            }
          });
      if (myInfo == null || myInfo.getRepositoryRootURL() == null) {
        myException =
            new VcsException("File ''{0}'' is not under version control" + myFile.getIOFile());
        return;
      }
      if (myInfo.getURL() == null) {
        myException =
            new VcsException("File " + myFile.getPath() + " is not under Subversion control");
        return;
      }
      myUrl = myInfo.getURL().toString();
    }
  /** Test method for {@link svn.client.SVNClient#doCheckOut(java.util.Date)}. */
  @Test
  public void testGetWCInfo() {

    try {
      SVNWCClient wcCln = svnCln.getSVNWCClient();

      SVNInfo svnInfo = wcCln.doInfo(new File(this.wcPath), SVNRevision.HEAD);
      String lastCommitter = svnInfo.getAuthor();
      assertEquals("thach", lastCommitter);

      Date lastDateCommit = svnInfo.getCommittedDate();
      LOG.debug("lastDateCommit=" + lastDateCommit);
      assertNotNull(lastDateCommit);

      long lastRev = svnInfo.getRevision().getNumber();
      assertEquals(99, lastRev);

      // Get SVNUrl
      LOG.debug("getChangelistName=" + svnInfo.getChangelistName());
      String svnUrl = svnInfo.getRepositoryRootURL().toDecodedString();

      assertEquals("http://svn.mkss.vn/svnobserver", svnUrl);
      analyzeFolder(new File(wcPath));
    } catch (SVNException ex) {
      ex.printStackTrace();
      fail(ex.getMessage());
    }
  }
  @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);
    }
  }
Example #5
0
 public void cleanup() throws SVNException {
   try {
     SVNWCClient wcClient = ourClientManager.getWCClient();
     wcClient.doCleanup(destPath);
   } catch (Exception e) {
   }
 }
  public void testStatusDoesNotLockForWrite() throws Exception {
    final File ioFile = new File(myWorkingCopyRoot, filename);
    ioFile.getParentFile().mkdirs();

    /*SVNWCClient client11 = new SVNWCClient((ISVNRepositoryPool)null, new DefaultSVNOptions());
    client11.doAdd(ioFile.getParentFile(), true, false, true, true);*/

    ioFile.createNewFile();
    try {
      final SVNStatusClient readClient =
          new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
      final Semaphore semaphore = new Semaphore();
      final Semaphore semaphoreMain = new Semaphore();
      final Semaphore semaphoreWokeUp = new Semaphore();

      final AtomicReference<Boolean> wasUp = new AtomicReference<Boolean>(false);
      final ISVNStatusHandler handler =
          status -> {
            semaphore.waitFor();
            wasUp.set(true);
          };

      semaphore.down();
      semaphoreMain.down();
      semaphoreWokeUp.down();

      final SVNException[] exception = new SVNException[1];
      Thread thread =
          new Thread(
              () -> {
                try {
                  semaphoreMain.up();
                  readClient.doStatus(myWorkingCopyRoot, true, false, true, false, handler);
                  semaphoreWokeUp.up();
                } catch (SVNException e) {
                  exception[0] = e;
                }
              },
              "svn test");
      thread.start();

      semaphoreMain.waitFor();
      TimeoutUtil.sleep(5);
      SVNWCClient client = new SVNWCClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
      client.doAdd(ioFile.getParentFile(), true, false, true, true);
      semaphore.up();
      semaphoreWokeUp.waitFor();

      Assert.assertEquals(true, wasUp.get().booleanValue());
      if (exception[0] != null) {
        throw exception[0];
      }
      thread.join();
    } finally {
      ioFile.delete();
    }
  }
 public SVNInfo getInfo(File ioFile) {
   try {
     SVNWCClient wcClient = createWCClient();
     SVNInfo info = wcClient.doInfo(ioFile, SVNRevision.UNDEFINED);
     if (info == null || info.getRepositoryRootURL() == null) {
       info = wcClient.doInfo(ioFile, SVNRevision.HEAD);
     }
     return info;
   } catch (SVNException e) {
     return null;
   }
 }
  private void collectLogEntries(
      final ProgressIndicator indicator,
      FilePath file,
      VcsException[] exception,
      final Consumer<VcsFileRevision> result,
      final Ref<Boolean> supports15Ref)
      throws SVNException, VcsException {
    SVNWCClient wcClient = myVcs.createWCClient();
    SVNInfo info =
        wcClient.doInfo(new File(file.getIOFile().getAbsolutePath()), SVNRevision.UNDEFINED);
    wcClient.setEventHandler(
        new ISVNEventHandler() {
          public void handleEvent(SVNEvent event, double progress) throws SVNException {}

          public void checkCancelled() throws SVNCancelException {
            indicator.checkCanceled();
          }
        });
    if (info == null || info.getRepositoryRootURL() == null) {
      exception[0] =
          new VcsException("File ''{0}'' is not under version control" + file.getIOFile());
      return;
    }
    final String url = info.getURL() == null ? null : info.getURL().toString();
    String relativeUrl = url;
    final SVNURL repoRootURL = info.getRepositoryRootURL();

    final String root = repoRootURL.toString();
    if (url != null && url.startsWith(root)) {
      relativeUrl = url.substring(root.length());
    }
    if (indicator != null) {
      indicator.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", url));
    }
    final SVNRevision pegRevision = info.getRevision();
    SVNLogClient client = myVcs.createLogClient();

    final boolean supports15 = SvnUtil.checkRepositoryVersion15(myVcs, url);
    supports15Ref.set(supports15);
    client.doLog(
        new File[] {new File(file.getIOFile().getAbsolutePath())},
        SVNRevision.HEAD,
        SVNRevision.create(1),
        SVNRevision.UNDEFINED,
        false,
        true,
        supports15,
        0,
        null,
        new MyLogEntryHandler(
            myVcs, url, pegRevision, relativeUrl, result, repoRootURL, file.getCharset()));
  }
 public Object invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException {
   File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile();
   try {
     log(listener, "Cleanup working copy: " + workingCopy);
     ISVNAuthenticationManager sam = SVNWCUtil.createDefaultAuthenticationManager();
     sam.setAuthenticationProvider(authProvider);
     SVNWCClient wcClient = new SVNWCClient(sam, null);
     wcClient.doCleanup(workingCopy);
     return null;
   } catch (SVNException e) {
     throw new IOException(e.getMessage());
   }
 }
    public String invoke(File p, VirtualChannel channel) throws IOException {
      final SVNClientManager manager = SubversionSCM.createSvnClientManager(authProvider);
      try {
        final SVNWCClient svnwc = manager.getWCClient();

        SVNInfo info;
        try {
          info = svnwc.doInfo(p, SVNRevision.WORKING);
          return info.getURL().toDecodedString();
        } catch (SVNException e) {
          e.printStackTrace();
          return null;
        }
      } finally {
        manager.dispose();
      }
    }
  @Test
  public void testRefusedAddVariant() throws Exception {
    SVNWCDb db = new SVNWCDb();
    final File ioFile = new File(myWorkingCopyRoot, filename + System.currentTimeMillis());
    ioFile.createNewFile();

    System.out.println(getStatus(ioFile));

    SVNWCContext context = null;
    try {
      db.open(ISVNWCDb.SVNWCDbOpenMode.ReadWrite, new DefaultSVNOptions(), true, true);
      context =
          new SVNWCContext(
              db,
              new ISVNEventHandler() {
                @Override
                public void handleEvent(SVNEvent event, double progress) throws SVNException {}

                @Override
                public void checkCancelled() throws SVNCancelException {}
              });

      File file = context.acquireWriteLock(myWorkingCopyRoot, false, true);
      boolean failed = false;
      try {
        SVNWCClient client = new SVNWCClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
        client.doAdd(ioFile, true, false, false, true);
      } catch (SVNException e) {
        Assert.assertEquals(155004, e.getErrorMessage().getErrorCode().getCode());
        failed = true;
      }
      Assert.assertTrue(failed);

      System.out.println(getStatus(ioFile));
    } finally {
      if (context != null) {
        context.releaseWriteLock(myWorkingCopyRoot);
      }
      ioFile.delete();
      db.close();
    }
  }
 @Override
 protected void load() {
   if (myPI != null) {
     myPI.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", myUrl));
   }
   SVNWCClient wcClient = myVcs.createWCClient();
   try {
     final SVNURL svnurl = SVNURL.parseURIEncoded(myUrl);
     SVNInfo info = null;
     info = wcClient.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.HEAD);
     final String root = info.getRepositoryRootURL().toString();
     String relativeUrl = myUrl;
     if (myUrl.startsWith(root)) {
       relativeUrl = myUrl.substring(root.length());
     }
     SVNLogClient client = myVcs.createLogClient();
     client.doLog(
         svnurl,
         new String[] {},
         SVNRevision.UNDEFINED,
         SVNRevision.HEAD,
         SVNRevision.create(1),
         false,
         true,
         mySupport15,
         0,
         null,
         new RepositoryLogEntryHandler(
             myVcs,
             myUrl,
             SVNRevision.UNDEFINED,
             relativeUrl,
             myConsumer,
             info.getRepositoryRootURL()));
   } catch (SVNCancelException e) {
     //
   } catch (SVNException e) {
     myException = new VcsException(e);
   } catch (VcsException e) {
     myException = e;
   }
 }
 @Nullable
 private VcsRevisionNumber getCurrentRevision(FilePath file) {
   if (file.isNonLocal()) {
     // technically, it does not make sense, since there's no "current" revision for non-local
     // history (if look how it's used)
     // but ok, lets keep it for now
     return new SvnRevisionNumber(SVNRevision.HEAD);
   }
   try {
     SVNWCClient wcClient = myVcs.createWCClient();
     SVNInfo info =
         wcClient.doInfo(new File(file.getPath()).getAbsoluteFile(), SVNRevision.UNDEFINED);
     if (info != null) {
       return new SvnRevisionNumber(info.getRevision());
     } else {
       return null;
     }
   } catch (SVNException e) {
     return null;
   }
 }
  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();
  }
  @Test
  public void testGetInfo2() {
    DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true);
    SVNClientManager clientManager = SVNClientManager.newInstance(options, "", "");
    SVNWCClient wcClient = clientManager.getWCClient();

    /*
     * For using over http:// and https://
     */
    DAVRepositoryFactory.setup();

    // Create configuration file in current folder
    File configFile = new File(".rockysvn");
    String username = "******";
    String password = "******";
    ISVNAuthenticationManager authManager =
        SVNWCUtil.createDefaultAuthenticationManager(configFile, username, password);
    // String url = "https://open-ones.googlecode.com/svn/trunk/ProjectList/RockySVN";
    String url = "https://hcm-svn.fsoft.fpt.vn/svn/F15-HCAM/trunk";

    SVNRevision revision = SVNRevision.HEAD;
    File path = new File("D:/Project/MyProject/Open-Ones/RockySVN");
    try {
      SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
      repository.setAuthenticationManager(authManager);
      repository.getDatedRevision(new Date());
      long latestRev = repository.getLatestRevision();

      assertEquals(634, latestRev);
      SVNInfo svnInfo = wcClient.doInfo(path, revision);
      assertEquals("ThachLN", svnInfo.getAuthor());
      assertEquals(123, svnInfo.getRevision().getID());
      assertEquals(new Date(), svnInfo.getRevision().getDate());
    } catch (SVNException ex) {
      ex.printStackTrace();
      fail(ex.getMessage());
    }
  }
  public void run(@NotNull final ProgressIndicator indicator) {
    ProjectLevelVcsManager.getInstanceChecked(myProject).startBackgroundVcsOperation();
    indicator.setIndeterminate(true);
    final boolean supportsChangelists = myNewFormat.supportsChangelists();
    if (supportsChangelists) {
      myBeforeChangeLists = ChangeListManager.getInstance(myProject).getChangeListsCopy();
    }
    final SVNWCClient wcClient = myVcs.createWCClient();

    try {
      for (WCInfo wcInfo : myWcInfos) {
        File path = new File(wcInfo.getPath());
        if (!wcInfo.isIsWcRoot()) {
          path = SvnUtil.getWorkingCopyRoot(path);
        }
        indicator.setText(
            SvnBundle.message(
                "action.change.wcopy.format.task.progress.text",
                path.getAbsolutePath(),
                SvnUtil.formatRepresentation(wcInfo.getFormat()),
                SvnUtil.formatRepresentation(myNewFormat)));
        try {
          wcClient.doSetWCFormat(path, myNewFormat.getFormat());
        } catch (Throwable e) {
          myExceptions.add(e);
        }
      }
    } finally {
      ProjectLevelVcsManager.getInstance(myProject).stopBackgroundVcsOperation();

      // to map to native
      if (supportsChangelists) {
        SvnVcs.getInstance(myProject).processChangeLists(myBeforeChangeLists);
      }

      ApplicationManager.getApplication().getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
    }
  }
 private void collectLogEntriesForRepository(
     final ProgressIndicator indicator,
     FilePath file,
     final Consumer<VcsFileRevision> result,
     final Ref<Boolean> supports15Ref)
     throws SVNException, VcsException {
   final String url = file.getPath().replace('\\', '/');
   if (indicator != null) {
     indicator.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", url));
   }
   SVNWCClient wcClient = myVcs.createWCClient();
   final SVNURL svnurl = SVNURL.parseURIEncoded(url);
   SVNInfo info = wcClient.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.HEAD);
   final String root = info.getRepositoryRootURL().toString();
   String relativeUrl = url;
   if (url.startsWith(root)) {
     relativeUrl = url.substring(root.length());
   }
   SVNLogClient client = myVcs.createLogClient();
   final boolean supports15 = SvnUtil.checkRepositoryVersion15(myVcs, root);
   supports15Ref.set(supports15);
   // todo log in history provider
   client.doLog(
       svnurl,
       new String[] {},
       SVNRevision.UNDEFINED,
       SVNRevision.HEAD,
       SVNRevision.create(1),
       false,
       true,
       supports15,
       0,
       null,
       new RepositoryLogEntryHandler(
           myVcs, url, SVNRevision.UNDEFINED, relativeUrl, result, info.getRepositoryRootURL()));
 }
  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();
  }
Example #19
0
  /**
   * Pass the absolute path of the base directory where all example data will be created in arg[0].
   * The sample will create:
   *
   * <p>- arg[0]/exampleRepository - repository with some test data - arg[0]/exampleWC - working
   * copy checked out from exampleRepository
   */
  public static void main(String[] args) {
    // initialize SVNKit to work through file:/// protocol
    SamplesUtility.initializeFSFSprotocol();

    File baseDirectory = new File(args[0]);
    File reposRoot = new File(baseDirectory, "exampleRepository");
    File wcRoot = new File(baseDirectory, "exampleWC");

    try {
      // first create a repository and fill it with data
      SamplesUtility.createRepository(reposRoot);
      SVNCommitInfo info = SamplesUtility.createRepositoryTree(reposRoot);
      // print out new revision info
      System.out.println(info);

      SVNClientManager clientManager = SVNClientManager.newInstance();
      clientManager.setEventHandler(new EventHandler());

      SVNURL reposURL = SVNURL.fromFile(reposRoot);

      // copy A to A_copy in repository (url-to-url copy)
      SVNCopyClient copyClient = clientManager.getCopyClient();
      SVNURL A_URL = reposURL.appendPath("A", true);
      SVNURL copyTargetURL = reposURL.appendPath("A_copy", true);
      SVNCopySource copySource = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, A_URL);
      info =
          copyClient.doCopy(
              new SVNCopySource[] {copySource},
              copyTargetURL,
              false,
              false,
              true,
              "copy A to A_copy",
              null);
      // print out new revision info
      System.out.println(info);

      // checkout the entire repository tree
      SamplesUtility.checkOutWorkingCopy(reposURL, wcRoot);

      // now make some changes to the A tree
      SamplesUtility.writeToFile(new File(wcRoot, "iota"), "New text appended to 'iota'", true);
      SamplesUtility.writeToFile(new File(wcRoot, "A/mu"), "New text in 'mu'", false);

      SVNWCClient wcClient = SVNClientManager.newInstance().getWCClient();
      wcClient.doSetProperty(
          new File(wcRoot, "A/B"),
          "spam",
          SVNPropertyValue.create("egg"),
          false,
          SVNDepth.EMPTY,
          null,
          null);

      // commit local changes
      SVNCommitClient commitClient = clientManager.getCommitClient();
      commitClient.doCommit(
          new File[] {wcRoot},
          false,
          "committing changes",
          null,
          null,
          false,
          false,
          SVNDepth.INFINITY);

      // now diff the base revision of the working copy against the repository
      SVNDiffClient diffClient = clientManager.getDiffClient();
      SVNRevisionRange rangeToMerge = new SVNRevisionRange(SVNRevision.create(1), SVNRevision.HEAD);

      diffClient.doMerge(
          A_URL,
          SVNRevision.HEAD,
          Collections.singleton(rangeToMerge),
          new File(wcRoot, "A_copy"),
          SVNDepth.UNKNOWN,
          true,
          false,
          false,
          false);

      // now make some changes to the A tree again
      // change file contents of iota and A/D/gamma
      SamplesUtility.writeToFile(new File(wcRoot, "iota"), "New text2 appended to 'iota'", true);
      SamplesUtility.writeToFile(new File(wcRoot, "A/D/gamma"), "New text in 'gamma'", false);
      // remove A/C from version control
      wcClient.doDelete(new File(wcRoot, "A/C"), false, true, false);

      // commit local changes
      commitClient.doCommit(
          new File[] {wcRoot},
          false,
          "committing changes again",
          null,
          null,
          false,
          false,
          SVNDepth.INFINITY);

      /* do the same merge call, merge-tracking feature will merge only those revisions
       * which were not still merged.
       */
      diffClient.doMerge(
          A_URL,
          SVNRevision.HEAD,
          Collections.singleton(rangeToMerge),
          new File(wcRoot, "A_copy"),
          SVNDepth.UNKNOWN,
          true,
          false,
          false,
          false);

    } catch (SVNException svne) {
      System.out.println(svne.getErrorMessage());
      System.exit(1);
    } catch (IOException ioe) {
      ioe.printStackTrace();
      System.exit(1);
    }
  }
Example #20
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);
  }
  @Override
  public Pair<SvnChangeList, FilePath> getOneList(final VirtualFile file, VcsRevisionNumber number)
      throws VcsException {
    final RootUrlInfo rootUrlInfo =
        myVcs.getSvnFileUrlMapping().getWcRootForFilePath(new File(file.getPath()));
    if (rootUrlInfo == null) return null;
    final VirtualFile root = rootUrlInfo.getVirtualFile();
    if (root == null) return null;
    final SvnRepositoryLocation svnRootLocation =
        (SvnRepositoryLocation) getLocationFor(new FilePathImpl(root));
    if (svnRootLocation == null) return null;
    final String url = svnRootLocation.getURL();
    final long revision;
    try {
      revision = Long.parseLong(number.asString());
    } catch (NumberFormatException e) {
      throw new VcsException(e);
    }

    final SvnChangeList[] result = new SvnChangeList[1];
    final SVNLogClient logger;
    final SVNRevision revisionBefore;
    final SVNURL repositoryUrl;
    final SVNURL svnurl;
    final SVNInfo targetInfo;
    try {
      logger = myVcs.createLogClient();
      revisionBefore = SVNRevision.create(revision);

      svnurl = SVNURL.parseURIEncoded(url);
      final SVNWCClient client = myVcs.createWCClient();
      final SVNInfo info = client.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.HEAD);
      targetInfo = client.doInfo(new File(file.getPath()), SVNRevision.UNDEFINED);
      if (info == null) {
        throw new VcsException("Can not get repository URL");
      }
      repositoryUrl = info.getRepositoryRootURL();
    } catch (SVNException e) {
      LOG.info(e);
      throw new VcsException(e);
    }

    tryExactHit(svnRootLocation, result, logger, revisionBefore, repositoryUrl, svnurl);
    if (result[0] == null) {
      tryByRoot(result, logger, revisionBefore, repositoryUrl);
      if (result[0] == null) {
        FilePath path =
            tryStepByStep(svnRootLocation, result, logger, revisionBefore, targetInfo, svnurl);
        path = path == null ? new FilePathImpl(file) : path;
        // and pass & take rename context there
        return new Pair<SvnChangeList, FilePath>(result[0], path);
      }
    }
    if (result[0].getChanges().size() == 1) {
      final Collection<Change> changes = result[0].getChanges();
      final Change change = changes.iterator().next();
      final ContentRevision afterRevision = change.getAfterRevision();
      if (afterRevision != null) {
        return new Pair<SvnChangeList, FilePath>(result[0], afterRevision.getFile());
      } else {
        return new Pair<SvnChangeList, FilePath>(result[0], new FilePathImpl(file));
      }
    }
    String relativePath =
        SVNPathUtil.getRelativePath(
            targetInfo.getRepositoryRootURL().toString(), targetInfo.getURL().toString());
    relativePath = relativePath.startsWith("/") ? relativePath : "/" + relativePath;
    final Change targetChange = result[0].getByPath(relativePath);
    if (targetChange == null) {
      FilePath path =
          tryStepByStep(svnRootLocation, result, logger, revisionBefore, targetInfo, svnurl);
      path = path == null ? new FilePathImpl(file) : path;
      // and pass & take rename context there
      return new Pair<SvnChangeList, FilePath>(result[0], path);
    }
    return new Pair<SvnChangeList, FilePath>(result[0], new FilePathImpl(file));
  }