I am using SVNKit to access a repository that contains binary files. I need to go to specific directories in the repository and retrieve a list of files from them. Then I do this:(sloppy code)
Collection<SVNDirEntry> entries=(Collection<SVNDirEntry> repository.getDir(omitted);
Iterator<SVNDirEntry> it=entries.iterator();
while(it.hasNext()){
SVNDirEntry entry=(SVNDirEntry) it.next();
if(entry.getName().contains("abc")){
list.add(entry.getName());
}
}
Most directories contain few files and I have no problem using getDir(....) from SVNRepository, but there is one folder that has about 10000 files(or more) and the application just comes to a stop when I try to do that. Even if I wait for hours nothing happens. Is there anyway to solve this? I don't really need all of the files, just the ones that contain a certain code in their filename. Could I ask the repository to only give me the filenames containing "abc" inorder to speed this up?
Btw, I know this isn't a good way to use Subversion but I am sadly forced to do it this way.
You're probably blowing up memory on your Collections statement.
Use the handler version of the getDir
method:
getDir(String path, long revision, Map properties, ISVNDirEntryHandler handler)
That way, you're only processing one file at a time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.