bikram kumar Nayak
bikram kumar Nayak

Reputation: 39

How to get the revision from SVN repository between two dates using Groovy Script?

I am using Groovy script.

I am trying to write a Groovy script for getting the revisions between two dates as we are getting the revision on SVN log. I am new to Groovy I tried many ways but failed to success.

Can any one please help me to get this task done.

Upvotes: 0

Views: 619

Answers (2)

roeygol
roeygol

Reputation: 5048

Maybe this could help you better: http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html#getDatedRevision(java.util.Date)

notice to function:

public abstract long getDatedRevision(Date date) SVNException

Upvotes: 0

roeygol
roeygol

Reputation: 5048

Try this code:

DAVRepositoryFactory.setup();
String url = "(directory in svn url)";
String name = "(login name)";
String password = "(login password)";
SVNRepository repository = null;
repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
ISVNAuthenticationManager authManager =
                   SVNWCUtil.createDefaultAuthenticationManager(name, password);
repository.setAuthenticationManager(authManager);
SVNDirEntry entry = repository.info(".", -1);
System.out.println("Latest Rev: " + entry.getRevision()); 

You will need to use the svnkit downloaded from here: http://svnkit.com/

Upvotes: 0

Related Questions