svnkit: Problem getting entry name

I'm trying to create a SVN Eclipese EFS plugin and have problems when getting the names of entries.

When I make a call to: SVNRepository

`//Fetches the contents of a directory into the provided collection object and returns the directory entry itself.

SVNDirEntry getDir(String path, long revision, boolean includeCommitMessages, Collection entries)`

It correctly returns the entry for the provided path, however, it doesn't set the "name" value on the "returned" entry. Note, the items returned in the collection are all OK.

Does anyone know why this is? And/or if there is a workaround?

See: http://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html http://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html#getDir(java.lang.String, long, boolean, java.util.Collection)

Answers


It correctly returns the entry for the provided path, however, it doesn't set the "name" value on the "returned" entry. Note, the items returned in the collection are all OK.

Treat it like "ls" command to list entries in the directory. The directory itself will be represented as ".". Or better to say that name of the entry is relative to the directory and for the directory itself it is an empty string.

Does anyone know why this is? And/or if there is a workaround?

Use dirEntry.getURL() and then you may compute name from the URL's path. Also, directory name is either part of the "path" parameter or part of the SVNRepository object location URL.


I've checked and the SVNDirEntry returned by the getDir() method always has its name attribute set to an empty string.

However when that method is used to fetch a directory listing each directory entry has its name properly assigned.

I think that behavior is somewhat buggy though you can still find out the name of an SVNDirEntry through its URL:

SVNDirEntry dirEntry = repository.getDir("branches/1.0", -1, false, null);
String name = SVNPathUtil.tail(dirEntry.getURL().getPath());

Need Your Help

Codeship CI returns unexplainable Composer error

php symfony continuous-integration composer-php

Running a CI build on codeship.io returns into an unexplainable error. The last lines of the debug text is:

struts2 interceptors and webservlets

java servlets struts2 interceptor struts2-interceptors

Is it possible to use a Struts2 interceptor for a page that doesn't have an action associated with it? Trying to implement an interceptor so all users must login. Yet the other pages in my site are