2

I am trying to get the log from a SVN repo using SVNKit.

public static void svnLogTest() {
    final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
    final SvnLog log = svnOperationFactory.createLog();
    SVNURL url = null;
    try {
        url = SVNURL
                .parseURIEncoded("https://svn-repo");
    } catch (SVNException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    log.setSingleTarget(SvnTarget.fromURL(url));
    log.addRange(SvnRevisionRange.create(SVNRevision.create(111),
            SVNRevision.create(222)));
    log.getRevisionRanges();
    SVNLogEntry logEntry = null;
    try {
        logEntry  = log.run();
        System.out.println(logEntry.getAuthor() + " " + logEntry.getRevision() + " " 
                + logEntry.getDate());

    } catch (SVNException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

But it will give me only the first revision, How should I iterate to print the log for a particular date range ?

1
  • 1
    log.getRevisionRanges(); have no purpose ;) Commented Apr 11, 2013 at 12:45

1 Answer 1

2

This is because

log.run();

always returns only one log entry (the same is true for other SvnOperation#run methods). To get all entries use receiver:

    log.setReceiver(new ISvnObjectReceiver<SVNLogEntry>() {
        @Override
        public void receive(SvnTarget target, SVNLogEntry logEntry) throws SVNException {
            //process logEntry here
        }
    });
    log.run();
Sign up to request clarification or add additional context in comments.

3 Comments

I am having some issues passing the date range.... I am trying with SVNRevision.create(Date new Date(2013-01-01))
What do you mean by "some issues"?
Error... Fixed it, by using Calendar. Was using the wrong date format.

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.