Reputation: 352
Can someone please tell me how to figure out branch of an svn tag? Would be great if there is any working code, that gets me branches for certain tags? Thanks.
I use this command line command as of now to see it on console
svn log -v -l 2 "path to tag"
Upvotes: 0
Views: 1122
Reputation: 352
Resolved.
ISVNLogEntryHandler handler = new ISVNLogEntryHandler() {
@Override
public void handleLogEntry(SVNLogEntry arg0) throws SVNException {
Map<String, SVNLogEntryPath> map = arg0.getChangedPaths();
for (Map.Entry<String, SVNLogEntryPath> entry: map.entrySet()) {
SVNLogEntryPath svnLogEntryPath = entry.getValue();
System.out.println(Calendar.getInstance().getTime());
System.out.println("Path : " + svnLogEntryPath.getPath());
System.out.println("Kind : " + svnLogEntryPath.getKind());
System.out.println("Type : " + svnLogEntryPath.getType());
System.out.println("Copy Path : " + svnLogEntryPath.getCopyPath()); // gives the tag's branch
System.out.println("Branch : " + svnLogEntryPath.getCopyPath().substring(svnLogEntryPath.getCopyPath().lastIndexOf('/')+1)); // gives the tag's branch
System.out.println("Copy Revision : " + svnLogEntryPath.getCopyRevision());
System.out.println("------------------------");
}
}
};
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, password);
boolean readonly = true;
ISVNOptions options = SVNWCUtil.createDefaultOptions(readonly);
// Get log client
SVNLogClient logClient = new SVNLogClient(authManager, options);
String[] paths = { pathToTag};
logClient.doLog(svnurl, paths, SVNRevision.HEAD, startRevision, SVNRevision.HEAD, true, true, 2, handler);
Upvotes: 1