Java Code Examples for org.tmatesoft.svn.core.SVNDirEntry#getName()

The following examples show how to use org.tmatesoft.svn.core.SVNDirEntry#getName() . 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: SubversionCommit.java    From Getaviz with Apache License 2.0 6 votes vote down vote up
private Map<String, VersionedFile> getFiles(String path, Iterable<Pattern> filters) throws FilesNotAvailableException {
	IterablePatternMatcher matcher = new IterablePatternMatcher();
	try {
		Map<String, VersionedFile> returnable = new HashMap<String, VersionedFile>();
		List<SVNDirEntry> entries = new ArrayList<SVNDirEntry>();
		repo.getDir(path, entry.getRevision(), false, entries);
		for (SVNDirEntry dirEntry : entries) {
			SVNNodeKind kind = dirEntry.getKind();
			String currentFilePath = path + dirEntry.getName();
			if (SVNNodeKind.FILE.equals(kind)) {
				if (matcher.isIncluded(filters, currentFilePath)) {
					returnable.put(currentFilePath, new LazySvnVersionedFile(repo, currentFilePath, this.entry.getRevision()));
				}
			} else if (SVNNodeKind.DIR.equals(kind)) {
				returnable.putAll(getFiles(currentFilePath + "/", filters));
			} else {
				System.err.println("skipping unknown versioned item " + currentFilePath);
			}
		}
		return returnable;
	} catch (SVNException e) {
		throw new FilesNotAvailableException(e);
	}
}
 
Example 2
Source File: SubversionRepository.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
private void addToMap(List<SVNDirEntry> currentEntries, Map<String, String> pathMap, String basePath) {
	for(SVNDirEntry entry : currentEntries){
		if(SVNNodeKind.DIR.equals(entry.getKind())){
			String entryName = entry.getName();
			pathMap.put(entryName, basePath + entryName);
		}
	}
}
 
Example 3
Source File: SvnClient.java    From steady with Apache License 2.0 5 votes vote down vote up
public Map<String, String> listEntries(String _path, String _asof, String _until) {
	Map<String, String> l = new HashMap<String, String>();
	//String rel_path = url.toString().replace(rootRepo.getDir("", -1, null, (Collection<SVNDirEntry>)null).iterator().next(), "");
	try {
		Collection<SVNDirEntry> entries = this.rootRepo.getDir(_path, -1, null,(Collection<SVNDirEntry>) null); //this.getDirEntries(path);
		Iterator<SVNDirEntry> iterator = entries.iterator();
		String name = null, path = null;

		long rev = -1;
		// Use an iterator to get all directory entries in a certain path ("tags/")

		int asof  = (_asof==null?-1:Integer.parseInt(_asof));
		int until = (_until==null?-1:Integer.parseInt(_until));

		while (iterator.hasNext()) {
			SVNDirEntry entry = (SVNDirEntry) iterator.next();

			SvnClient.log.debug( "Path mess: " + entry.getPath() + " | " + entry.getRelativePath() + " | " + entry.getRepositoryRoot() + " | " + entry.getExternalParentUrl() + " | "  + entry.getURL());

			name = entry.getName();
			rev = entry.getRevision();
			path = entry.getURL().toString().substring(entry.getRepositoryRoot().toString().length());
			if( asof<rev && (_until==null || rev<until) )
				l.put(path, Long.toString(rev));
		}
	} catch (Exception e) {
		SvnClient.log.error( "Error while getting directory entries: " + e.getMessage() );
	}

	// return the tag name and the corresponding revision number
	return l;
}