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? :)

Jup Zing
  • 11
  • 1
  • 1

1 Answers1

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.

Dmitry Pavlenko
  • 8,530
  • 3
  • 30
  • 38