当使用 svn cp 或 svn mv 时,如何使 svn diff 生成补丁将应用的文件?
场景是:
- svn cp 或 mv 某个文件
- 修改该文件
- svn diff > > mypatch
在其他机器上(相同的工作副本,但没有更改):
- 尝试应用 mypatch。
- 失败-> 尝试修改不存在的文件。
在这种情况下,如何使 svn diff 生成适用于补丁的补丁,或者干净地应用 svn diff 生成的补丁? 我无法承诺。 我想保留合并信息(因为明显的解决方法是将文件添加为全新的文件,而不连接到前一个文件)。
The scenario is:
- svn cp or mv some file
- modify that file
- svn diff > mypatch
On other machine (same working copy, but no changes):
- Try to apply mypatch.
- Fail -> tries to modify unexistant file.
How can I make svn diff produce patch-appliable patch, or cleanly apply patch produced by svn diff in this case? I can't commit. I would like to preserve mergeinfo (because the obvious workaround is to add the file as totally new, without connection to the previous one).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 subversion,您可以指定要使用的 diff 二进制文件以及要传递给它的参数。 请参阅关于 svn diff 的手册。
您希望从 svn diff 生成常规补丁文件,因此您希望 svn diff 看起来像普通 diff。 试试这个:
概念证明:
修补后两个文件没有区别。
With subversion, you can specify which diff binary to use, and parameters to pass to it. See the manual on svn diff.
You'd want to produce a regular patch file from a svn diff, so you'd want the svn diff to look like a normal diff. Try this:
Proof of concept:
No difference in the two files after patching.
如果你想在补丁中删除 svn 属性,有一个选项:
svn help diff
说:以这种方式创建的补丁应该与旧的普通
兼容。代码>补丁实用程序。
If you want to get rid of the svn properties as well in your patches, there is an option for that:
svn help diff
says:Patches created this way are supposed to be compatible with the good old plain
patch
utility.您是否尝试过 svn diff 网页并在 svn 选项页面?
Have you tried the
--show-copies-as-adds
option mentioned on the svn diff web page and described on the svn options page?.如果不了解您正在尝试处理的具体场景,就很难确定您想要这样做的原因。 我感觉您正在尝试在隔离的环境中进行受控更改,以避免影响其他用户/应用程序。
你能通过以下方式解决这个问题吗?
当你们都同意将更改合并回主干时,使用 - - 重新整合论点并 rm 分支?
这个会
* 维护合并信息
* 识别版本控制中的复制/移动和更改
* 仍然隔离其他用户的更改
* 将防止第 2 步期间出现不完整的更改,因为您只需添加更多更改并更新即可
Without understanding the specific scenario you're trying to work upon its hard to identify why you'd want to do this. I get the feeling you're trying to make controlled changes in an isolated environment so to avoid impacting other users/applications.
Could you solve this problem by;
When you've both agreed with the changes merge back into trunk using the --reintegrate argument and rm the branch?
This would
* Maintain merge-info
* Identify the copy/move and changes in version control
* Still isolate changes from other users
* Would prevent incomplete changes during step 2 being an issue as you could just add more changes and update