Java Code Examples for org.tmatesoft.svn.core.io.SVNRepository#info()

The following examples show how to use org.tmatesoft.svn.core.io.SVNRepository#info() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MCRVersionedMetadata.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks if the version in the local store is up to date with the latest
 * version in SVN repository
 *
 * @return true, if the local version in store is the latest version
 */
public boolean isUpToDate() throws IOException {
    SVNDirEntry entry;
    try {
        SVNRepository repository = getStore().getRepository();
        entry = repository.info(getFilePath(), -1);
    } catch (SVNException e) {
        throw new IOException(e);
    }
    return entry.getRevision() <= getRevision();
}
 
Example 2
Source File: CheckPathAndStatCmdTest.java    From git-as-svn with GNU General Public License v2.0 5 votes vote down vote up
private static void assertPath(@NotNull SVNRepository repository, @NotNull String path, long rev, @NotNull SVNNodeKind expectedKind) throws SVNException {
  final SVNNodeKind nodeKind = repository.checkPath(path, rev);
  Assert.assertEquals(nodeKind, expectedKind);

  final SVNDirEntry info = repository.info(path, rev);
  if (expectedKind == SVNNodeKind.NONE) {
    Assert.assertNull(info);
  } else {
    Assert.assertEquals(info.getKind(), expectedKind);
    Assert.assertEquals(info.getRevision(), rev);
  }
}
 
Example 3
Source File: SvnTestHelper.java    From git-as-svn with GNU General Public License v2.0 5 votes vote down vote up
public static void checkFileContent(@NotNull SVNRepository repo, @NotNull String filePath, @NotNull byte[] content) throws IOException, SVNException {
  final SVNDirEntry info = repo.info(filePath, repo.getLatestRevision());
  Assert.assertEquals(info.getKind(), SVNNodeKind.FILE);
  Assert.assertEquals(info.getSize(), content.length);

  try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
    repo.getFile(filePath, repo.getLatestRevision(), null, stream);
    Assert.assertEquals(stream.toByteArray(), content);
  }
}