【问题标题】:commit only directory and not the files in it只提交目录而不是其中的文件
【发布时间】:2020-09-12 01:59:21
【问题描述】:

我正在使用 SVNKit 中提供的 API,使用以下代码将文件提交到 SVN

ourClientManager.getWCClient().doAdd(subFile, false, false, true, false);
ourClientManager.getCommitClient().doCommit(path, false, comment, false, false);

当我提交一个新目录时,其中的文件会自动提交。 (我已将递归设置为 false。)有没有办法阻止它? 我想为提交的新目录和提交的文件传递不同的评论,所以我想分别提交它们。如果有办法,请提出建议。

【问题讨论】:

    标签: svn


    【解决方案1】:

    在 svn 命令中,你会做svn add --depth=empty mydirectory

    使用 SVNKit,为 SVNDepth 参数传入 EMPTY 值,例如:

    doAdd(mydirectory, false, false, false, SVNDepth.EMPTY)
    

    【讨论】:

      【解决方案2】:

      Luke给出的答案效果很好,但它不会在'mydirectory'中添加子目录,所以svn命令将是,

      svn add -N mydirectory
      

      进入'mydirectory'并执行此命令,

      svn propset svn:ignore '*.*'
      
      svn commit -m "Adding directory structure only"
      

      【讨论】:

        【解决方案3】:

        ci 也采用 --depth 开关,就像 add 一样,您不必对属性进行处理。

        svn add --parents directory_with_WIP/*.pl
        svn ci -m 'The new directory' --depth=empty directory_with_WIP
        svn ci -m 'First file ready' directory_with_WIP/flibber.pl
        

        【讨论】:

        • 哈!这只是我需要的信息,所以我尝试投票,但这是我自己的答案!大声笑出来。
        猜你喜欢
        • 2011-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多