如何使用svnkit jar java在svn中创建一个文件夹

时间:2014-10-08 08:38:47

标签: java svn svnkit

我需要使用svnkit jar在svn中创建一个文件夹。我尝试使用以下代码

           String url = Config.svnurl + "/" + qcuser + "/" + "Completedjobs";
            try {
                SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
                ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(Config.svnusername, Config.svnuserpwd);
                repository.setAuthenticationManager(authManager);
            } catch (SVNException e) {
                e.printStackTrace();
                System.exit(1);
            }

任何想法PLZ建议

1 个答案:

答案 0 :(得分:2)

请尝试以下代码

        SVNCommitClient commitClient = ourClientManager.getCommitClient();
        commitClient.setIgnoreExternals(false);
        SVNNodeKind nodeKind = null;
        try {
            nodeKind = repository.checkPath("", -1);
        } catch (SVNException ex) {
            Logger.getLogger(Reassignscreen.class.getName()).log(Level.SEVERE, null, ex);
        }
        if (nodeKind == SVNNodeKind.NONE) {
            System.err.println("There is no entry at '" + url + "'.");
            commitClient.doMkDir(new SVNURL[]{SVNURL.parseURIDecoded(url)}, "New Folder");
        }

它可以使用它