Question

I need to get log from SVNRepository from specific folder.

For example - I have

SVNURL url = SVNURL.parseURIEncoded("https://subversion.assembla.com/svn/jscrum");
SVNRepository svnRepository = DAVRepositoryFactory.create(url);

and I'm getting log from repository:

Collection logEntries = svnRepository.log(new String[] { "" }, null, startRevision, endRevision, true, true);

And it's working correct, but shows me log from whole repo. I need changes from folder on repo: "/trunk/js/web/src/main/webapp".

I've tried some 'tricks', but none of them are working :<

SVNURL url = SVNURL.parseURIEncoded("https://subversion.assembla.com/svn/jscrum/trunk/js/web/src/main/webapp");

or

Collection logEntries = svnRepository.log(new String[] { "/trunk/js/web/src/main/webapp" }, null, startRevision, endRevision, true, true);

One option is to check if returned path from whole repo contains my directory path, but it seems not so proffesional ; p

Thanks for any advices.

Était-ce utile?

La solution

Ok, so solution looks like this (for next generation of searchers :P):

for (Iterator entries = logEntries.iterator(); entries.hasNext();) {
                SVNLogEntry logEntry = (SVNLogEntry) entries.next();

                if (logEntry.getChangedPaths().size() > 0) {
                    Set<String> changedPathsSet = logEntry.getChangedPaths().keySet();

                    for (Iterator<String> changedPaths = changedPathsSet.iterator(); changedPaths
                            .hasNext();) {
                        SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry
                                .getChangedPaths().get(changedPaths.next());
                        String path = entryPath.getPath();
                        if (!path.startsWith(updatePath)) {
                            continue;
                        }

+ end of for(s) and if(s)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top