在SVN差异中包含新文件
收藏

我有一个脚本可以构建我的应用程序,然后将其上传到远程计算机,在那里运行性能测试并捕获一些我关心的指标。该脚本为我在工作空间中进行的本地修改创建了补丁文件,并将其与性能编号一起显示。这可以帮助我比较各种调整选项的效果。如果以后要重新创建工作区,可以使用SVN修订版号和补丁程序。

svn diff does not report a new files I add to the workspace unless I explicitly use svn add on them first. Is there some way to create a patch file which will include the new files also?

PS:IMO在这里提出了类似的问题,但未得到充分回答。

最佳答案

To make svn diff include all the unversioned files from your local working copy you have to add these files first. svn diff outputs the same changeset that svn commit would use.

如果您确定应该添加所有未版本控制的文件,则可以执行以下操作。

Prepare a list of unversioned files by taking from the output of svn status all the lines that start with a question mark:

svn status | grep ^? | sed -r 's/^\? +//' > ../unversioned_files_list.txt

You can then pass that list of files to svn addusing xargs:

xargs -r -d '\n' svn add < ../unversioned_files_list.txt

然后产生补丁:

svn diff > ../my_patch.patch

如果您不想保留这些文件,请使用文件列表来取消添加它们:

xargs -r -d '\n' svn rm --keep-local < ../unversioned_files_list.txt

    公众号
    关注公众号订阅更多技术干货!