【问题标题】:Unable to commit a directory tree with SVNKit无法使用 SVNKit 提交目录树
【发布时间】:2011-04-19 10:32:43
【问题描述】:

我有一个目录,其中包含来自旧版构建系统的文件。我想在 SVN 存储库中重新创建此构建系统的时间线。

为此,我必须获取每个构建,提取其所有文件,将它们放在合理的目录结构中,将整个目录结构提交给 svn,并为每个构建创建标签(以便轻松识别它们)。现在,我能够从该系统中获取文件,将它们放在一个目录结构中,并且我正在尝试使用 SVNKit 将整个目录放入 SVN(因为整个同步系统是一个使用 Java 代码的系统)。

所以,我要做的是

  1. 使用SVNWCClient.doAdd(main.workDirectory, true, false, false, SVNDepth.INFINITY, false, false /* we only add files below this path */)将所有新文件添加到svn
  2. 然后使用SVNCommitClient.doCommit(changedFiles, false, null, commitProps, null, false, true, SVNDepth.INFINITY) 提交整个目录

不幸的是,它并没有那么好......

确实,每次我尝试调用这些方法时,我都会得到

Exception in thread "main" org.tmatesoft.svn.core.SVNException: svn: Commit failed (details follow):
svn: 'E:\JavaWorkspace\workDirectory\subpath\deep\below\initial\path' is not under version control
and is not part of the commit, 
yet its child is part of the commit
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:85)
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:69)
    at org.tmatesoft.svn.core.wc.SVNCommitClient.doCollectCommitItems(SVNCommitClient.java:1236)
    at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:825)
    at com.perigee.svnsync.SvnExecutor.commit(SvnExecutor.java:229)
    at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:40)
Caused by: org.tmatesoft.svn.core.SVNException: svn: 'E:\JavaWorkspace\workDirectory\subpath\deep\below\initial\path' is not under version control
and is not part of the commit, 
yet its child is part of the commit
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
    at org.tmatesoft.svn.core.internal.wc.SVNCommitUtil.harvestCommitables(SVNCommitUtil.java:546)
    at org.tmatesoft.svn.core.wc.SVNCommitClient.doCollectCommitItems(SVNCommitClient.java:1208)

请注意,当我使用 TortoiseSVN 查看这个文件夹时,它似乎是一个完美的“普通”文件夹,可以添加到 SVN 中......此外,我可以使用 TortoiseSVn 提交根目录及其所有子目录,而无需最小的问题。那么,我可以/应该更改我的代码以使其正常工作吗?

【问题讨论】:

    标签: java tortoisesvn commit svnkit


    【解决方案1】:

    事实上,有一个微妙的问题。让我解释一下。

    当我调用SVNCommitClient.doCommit(changedFiles, false, null, commitProps, null, false, true, SVNDepth.INFINITY) 时,SVNKit 期望我像真正的 svn 命令行客户端一样,提供作为文件数组(第一个参数,changedFiles)的提交基目录列表。欲了解更多信息,请查看svn book

    我使用该命令所做的只是在每个文件上精确地直接提交它。不幸的是,因为这是我的第一次提交,那些文件目录还没有在 SVN 中,因此提交失败了。

    因此,解决方案是将changedFiles 替换为使用的根目录,并且它很简单。

    【讨论】:

      猜你喜欢
      • 2013-09-20
      • 1970-01-01
      • 2017-07-11
      • 2013-10-24
      • 2016-01-20
      • 2014-04-18
      • 2017-06-12
      • 2021-11-24
      • 1970-01-01
      相关资源
      最近更新 更多