在SVN差异中包含新文件 [英] Including new files in SVN diff
问题描述
我有一个脚本来构建我的应用程序,然后将其上传到远程计算机,在该计算机上运行性能测试并捕获一些我关心的指标。该脚本为我在工作空间中进行的本地修改创建了补丁文件,并将其与性能编号一起显示。这可以帮助我比较各种调整选项的效果。如果以后要重新创建工作区,可以使用SVN修订版号和补丁。
I have a script which builds my application, uploads it to a remote machine, runs a performance test there and captures some metrics that I care about. The script creates a patch file for the local modifications I make in my workspace and shows it along with the performance numbers. This helps me compare the effect of various tuning options. If I want to recreate my workspace at a later date, I can use the SVN revision number and the patch.
svn diff
不会报告我添加到工作区的新文件,除非我先对它们明确使用 svn add
。有什么方法可以创建一个也将包括新文件的补丁文件?
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。
PS: A similar question was asked here but was not answered adequately, IMO.
推荐答案
要使 svn diff
包含本地工作副本中的所有未版本控制的文件,必须首先添加这些文件。 svn diff
输出与 svn commit
使用的更改集相同的更改集。
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.
如果您确定应该添加所有未版本控制的文件,这就是您可以执行的操作。
If you know for sure that all unversioned files should be added here's what you could do.
通过提取<$的输出来准备未版本控制的文件列表。 c $ c> svn status 所有以问号开头的行:
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
然后您可以将该文件列表传递给使用
: xargs
svn add
You can then pass that list of files to svn add
using xargs
:
xargs -r -d '\n' svn add < ../unversioned_files_list.txt
然后生成补丁:
svn diff > ../my_patch.patch
如果您不想保留这些文件,请使用列表要取消添加的文件数量:
If you don't want to keep those files added, use the list of files to unadd them:
xargs -r -d '\n' svn rm --keep-local < ../unversioned_files_list.txt
这篇关于在SVN差异中包含新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!