无法使用 SVNKit 提交目录树

发布于 2024-09-25 13:39:34 字数 2622 浏览 3 评论 0原文

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

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

所以,我所做的就是

  1. 使用 SVNWCClient.doAdd(main.workDirectory, true, false, false , SVNDepth.INFINITY, false, false /* 我们只在此路径下添加文件 */)
  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 提交根目录及其所有子目录,而不会出现任何问题。那么,我可以/应该更改我的代码以使其正常工作吗?

I've a directory containing files from a legacy build system. i want to recreate the timeline of this build system in a SVN repository.

For that, I have to take each build, extract all its files, put them in a sensible directory structure, commit the whole directory structure to svn, and create tags for each build (in order to easily identify them). For now, I'm able to take the files from that system, put them in a directory structure, and I'm trying to put that whole directory into SVN using SVNKit (as the whole synchronization system is one using Java code).

So, what I do is

  1. adding all new files to svn using SVNWCClient.doAdd(main.workDirectory, true, false, false, SVNDepth.INFINITY, false, false /* we only add files below this path */)
  2. Then commiting the whole directory using SVNCommitClient.doCommit(changedFiles, false, null, commitProps, null, false, true, SVNDepth.INFINITY)

Unfortunatly, it does not work that well ...

indeed, each time i try to call those methods, i get

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)

Notice that, when I look at this folder using TortoiseSVN, it seems like a perfectly "normal" folder to add in SVN... Furthermore, I'm able to commit the root directory and all its children using TortoiseSVn without the smallest issue. So, is it something I could/should change to my code to make it working ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十雾 2024-10-02 13:39:34

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

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

我对这个命令所做的就是精确地在每个文件上直接提交它。不幸的是,由于这是我的第一次提交,这些文件目录尚未在 SVN 中,因此提交惨败。

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

In fact, there was a subtle issue. let me explain it.

When I call SVNCommitClient.doCommit(changedFiles, false, null, commitProps, null, false, true, SVNDepth.INFINITY), SVNKit expects me, like real svn command line client, to give as files array (the first parameter, changedFiles) a list of commit base directories. For more info, take a look at svn book.

What I did instead with that command is go precisely on each fole to commit it directly. unfortunatly, as it was my first commit, those files directories were not yet in SVN, and as a consequence commit failed miserably.

As a consequence, solution was to replace changedFiles with the used root dir, and it simply worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文