0

I'm sure this question will be silly or annoying on multiple levels....

I am using SVNKit in Java.

I want to get the list of files committed in a particular commit. I have the release ID. Normally I would run something like

svn log url/to/repository -qv -r12345

And I would get the list of commands as normal.

I can't puzzle out how to do a similar thing in SVNKit. Any tips? :)

1 Answer 1

2
final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
final SvnLog log = svnOperationFactory.createLog();
log.setSingleTarget(SvnTarget.fromURL(url));
log.addRange(SvnRevisionRange.create(SVNRevision.create(12345), SVNRevision.create(12345)));
log.setDiscoverChangedPaths(true);
final SVNLogEntry logEntry = log.run();

final Map<String,SVNLogEntryPath> changedPaths = logEntry.getChangedPaths();
for (Map.Entry<String, SVNLogEntryPath> entry : changedPaths.entrySet()) {
    final SVNLogEntryPath svnLogEntryPath = entry.getValue();
    System.out.println(svnLogEntryPath.getType() + " " + svnLogEntryPath.getPath() +
            (svnLogEntryPath.getCopyPath() == null ?
                    "" : (" from " + svnLogEntryPath.getCopyPath() + ":" + svnLogEntryPath.getCopyRevision())));
}

If you want to run one log request for a revision range, you should use log.setReceiver() call with your receiver implemetation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.