颠覆差异,包括新文件

发布于 2024-07-07 15:36:51 字数 336 浏览 8 评论 0原文

我对一个使用 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 技术交流群。

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

发布评论

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

评论(4

计㈡愣 2024-07-14 15:36:51

我也经历过与 Pozsar 类似的行为。 他的回答对我来说比普通的 svn diff --force 更好。 但是,如果在 DOS 机器上运行(例如通过 Cygwin),您可能需要稍微修改他的答案。 以下 diff + patch 用于使用 --binary arg 修补 Cygwin 中的文本 + 二进制文件:

svn diff --force --diff-cmd /usr/bin/diff -x "-au --binary" OLD-URL NEW-URL > mybinarydiff.diff

patch -p0 --binary -i mybinarydiff.diff

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:

svn diff --force --diff-cmd /usr/bin/diff -x "-au --binary" OLD-URL NEW-URL > mybinarydiff.diff

patch -p0 --binary -i mybinarydiff.diff
贪恋 2024-07-14 15:36:51

diff 命令有一个 --force 选项,但它为我的计算机上的二进制文件生成了错误的补丁文件。 不过,将它与 --diff-cmd 选项一起使用对我来说很有效:

svn diff --force --diff-cmd /usr/bin/diff -x -au

我认为这正是您想要的。

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:

svn diff --force --diff-cmd /usr/bin/diff -x -au

I think this produces exactly what you wanted.

深居我梦 2024-07-14 15:36:51

恐怕您的文件是二进制文件正是它不显示的原因。 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).

め可乐爱微笑 2024-07-14 15:36:51

如果您正在构建补丁,您可能需要使用普通的旧“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.

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