颠覆差异,包括新文件
我对一个使用 Subversion 作为源代码控制的开源项目进行了一些本地更改。 (我没有原始项目存储库的提交访问权限。)
我的更改添加了一个文件,但该文件不包含在“svn diff”的输出中。 (可能值得注意的是,新文件是二进制文件,而不是纯文本。)
我怎样才能制作 补丁 其中包含新文件?
$ svn st
A tests/foo.zip
$ svn diff
$
I have some local changes to an open source project which uses Subversion as its source control. (I do not have commit access on the original project repository.)
My change adds a file, but this file is not included in the output of "svn diff". (It may be worth noting that the new file is a binary, not plain text.)
How can I make a patch which includes the new files?
$ svn st
A tests/foo.zip
$ svn diff
$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我也经历过与 Pozsar 类似的行为。 他的回答对我来说比普通的 svn diff --force 更好。 但是,如果在 DOS 机器上运行(例如通过 Cygwin),您可能需要稍微修改他的答案。 以下 diff + patch 用于使用 --binary arg 修补 Cygwin 中的文本 + 二进制文件:
I experienced similar behavior to Pozsar. And his answer worked for me better than the normal svn diff --force. However, if running on a DOS machine (e.g. via Cygwin), you may need to modify his answer slightly. The following diff + patch worked for patching my text + binary files in Cygwin using the --binary arg:
diff 命令有一个 --force 选项,但它为我的计算机上的二进制文件生成了错误的补丁文件。 不过,将它与 --diff-cmd 选项一起使用对我来说很有效:
我认为这正是您想要的。
There is a --force option to the diff command, but it produces an incorrect patch file for binaries on my machine. Using it with the --diff-cmd option works for me though:
I think this produces exactly what you wanted.
恐怕您的文件是二进制文件正是它不显示的原因。 Subversion 的 diff 命令仅执行文本差异/补丁(尽管 Subversion 内部可以有效地处理版本之间的二进制文件差异)。
The fact that your file is binary is exactly why it is not displayed I'm afraid. Subversion's diff command only does textual diffs/patches (even though Subversion internally can handle binary file differences efficiently between versions).
如果您正在构建补丁,您可能需要使用普通的旧“diff”和 --new-file 选项,该选项将丢失的文件视为空。
请注意,此选项的语法实际上可能会有所不同,具体取决于您使用的普通旧 diff 版本。
If you're building a patch, you might want to use plain old 'diff' with the --new-file option which treats the missing file as empty.
Note that the syntax for this option may actually vary depending on what version of plain old diff you're using.