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

The following examples show how to use org.tmatesoft.svn.core.io.SVNRepository#getDir() . 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: SubversionRepository.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
private void searchEntriesFor(SVNRepository repository, long latestRevision, Map<String, String> pathmap, String searchable) throws SVNException {
	List<SVNDirEntry> currentEntries = new ArrayList<>();
	try {
		repository.getDir(searchable, latestRevision, false, currentEntries);
	} catch (SVNException e) {
		if(!SVNErrorCode.FS_NOT_FOUND.equals(e.getErrorMessage().getErrorCode())){
			throw e;
		}
	}
	addToMap(currentEntries, pathmap, basePath + "/" + searchable + "/");
}
 
Example 2
Source File: TestCheckOut.java    From klask-io with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Méthode traverse.<br>
 * Rôle :
 *
 * @param updateClient
 * @param repository
 * @param checkoutRootPath
 * @param destRootPath
 * @param repoPath
 * @param evictTags        : si on tombe une première fois sur trunk, branches ou tags, alors on n'élague plus les nouvelles occurrences rencontrées
 * @throws SVNException
 */
public static void traverse(final SVNUpdateClient updateClient, final SVNRepository repository, final String checkoutRootPath, final String destRootPath, final String repoPath,
                            final boolean evictTags) throws SVNException {

    System.out.println(repoPath);

    if (!evictTags) {
        checkout(updateClient, checkoutRootPath, destRootPath, repoPath, SVNDepth.INFINITY);
    } else {
        checkout(updateClient, checkoutRootPath, destRootPath, repoPath, SVNDepth.FILES);

        final Collection<SVNDirEntry> entries = repository.getDir(repoPath, -1, null, (Collection) null);
        for (final SVNDirEntry entry : entries) {
            if (entry.getKind() != SVNNodeKind.DIR) {
                continue;
            }
            boolean copieEvict = evictTags;

            if (motsClefsSVN.contains(entry.getName())) {
                copieEvict = false;
            }
            //si on doit encore passer le niveau tags/branches/trunk et que le rép courant n'est pas tags, alors on poursuit
            if (!entry.getName().equalsIgnoreCase(TAGS)) {
                traverse(
                    updateClient,
                    repository,
                    checkoutRootPath,
                    destRootPath,
                    repoPath.equals("") ? entry.getName() : repoPath + "/" + entry.getName(),
                    copieEvict);
            }
        }
    }
}
 
Example 3
Source File: SvnUtil.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
public static void listEntries(SVNRepository repository, String path) throws SVNException {
       Collection<?> entries = repository.getDir(path, -1, null, (Collection<?>) null);
       Iterator<?> iterator = entries.iterator();
       while (iterator.hasNext()) {
           SVNDirEntry entry = (SVNDirEntry) iterator.next();
           System.out.println("/" + (path.equals("") ? "" : path + "/") + entry.getName() + " (author: '" + entry.getAuthor() + "'; revision: " + entry.getRevision() + "; date: " + entry.getDate() + ")");
           if (entry.getKind() == SVNNodeKind.DIR) {
               listEntries(repository, (path.equals("")) ? entry.getName(): path + "/" + entry.getName());
           }
       }
}
 
Example 4
Source File: SvnUtil.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
public static List<SVNDirEntry> getEntries(SVNRepository repository, String path) throws SVNException {
	Collection<?> entries = repository.getDir(path, -1, null, (Collection<?>) null);
	List<SVNDirEntry> entryURLs= new ArrayList<SVNDirEntry>();
	Iterator<?> iterator = entries.iterator();
       
       while (iterator.hasNext()) {
       	SVNDirEntry entry = (SVNDirEntry) iterator.next();
       	entryURLs.add(entry);
       	if (entry.getKind() == SVNNodeKind.DIR) {
               entryURLs.addAll(getEntries(repository, (path.equals("")) ? entry.getName(): path + "/" + entry.getName()) );
           }
       }
       
       return entryURLs;
}
 
Example 5
Source File: SvnTestHelper.java    From git-as-svn with GNU General Public License v2.0 4 votes vote down vote up
public static void checkDirProp(@NotNull SVNRepository repo, @NotNull String filePath, @Nullable Map<String, String> expected) throws SVNException {
  SVNProperties props = new SVNProperties();
  repo.getDir(filePath, repo.getLatestRevision(), props, new ArrayList<>());
  checkProp(props, expected);
}