如何使用SVNKit java API了解标签的分支?

时间:2013-03-12 06:21:14

标签: svnkit

有人可以告诉我如何找出svn标签的分支吗?如果有任何工作代码会让我成为某些标签的分支,那会很棒吗?感谢。

我现在使用此命令行命令在控制台上看到它

svn log -v -l 2“标记路径”

1 个答案:

答案 0 :(得分:1)

解决。

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);