将 TortoiseMerge 设置为 SVN 的外部合并工具?
是否可以将TortoiseMerge(TortoiseSVN附带)设置为使用“svn merge”命令行遇到合并冲突时弹出的外部合并工具?我尝试将环境变量“SVN_MERGE”设置为指向TortoiseMerge.exe,但这似乎还不够。当我选择“l”(启动外部工具)时,TortoiseMerge 就会弹出,询问我要合并哪些文件。我希望这些信息自动推送到工具中。
有什么想法吗?
Is it possible to set up TortoiseMerge (comes with TortoiseSVN) to be the external merge tool that pops up when you encounter a merge conflict using the "svn merge" commandline? I have tried setting my environment variable "SVN_MERGE" to point to TortoiseMerge.exe, but this doesn't seem to be enough. TortoiseMerge just pops up when I choose "l" (to launch an external tool) asking me what files I want to merge. I want this information to be pushed into the tool automatically.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个如下所示的 bat 脚本:
然后将 SVN_MERGE 环境变量设置为该 bat 脚本:
Create a bat script that looks like this:
Then set the SVN_MERGE environment variable to that bat script:
我不知道您使用的是哪个版本的 Subversion,因此我将尝试参考最新版本的 Subversion 文档,适用于 1.6。 (他们在该页面上添加了“如果您为特定部分添加书签或链接,这些链接可能会因继续开发而失效。”但是 1.6 没有稳定的版本。)
首先,坏消息 :
稍微好一点的消息是 Subversion 在某种程度上已经预料到了你的问题。请参阅 使用部分外部差异和合并工具;有外部合并工具包装器的模板。
在您的具体情况下, TortoiseMerge 文档 具有 < a href="http://tortoisesvn.net/docs/release/TortoiseMerge_en/tme-automation.html" rel="nofollow noreferrer" title="Automating TortoiseMerge">一个附录解释如何从命令行。基本的开关是
/base
、/mine
和/theirs
,但您可能想使用更多(您正在编写自己的包装器)毕竟是脚本)。 TortoiseMerge 还允许使用“简化形式”的命令:将合并结果传达回 Subversion 的方法是将合并的文件写入标准输出并返回适当的值。此信息位于 Subversion 手册中包装模板的显着位置。
I don't know which version of Subversion you're using, so I'm going to try to refer to information in the most recent version of the Subversion documentation, for 1.6. (They add on that page that "if you bookmark or link to specific sections, those links may be invalidated by continuing development." But there is no stable version for 1.6.)
First, the bad news:
The slightly better news is that Subversion has anticipated your question, somewhat. See the section Using External Differencing and Merge Tools; there are templates of external merge tool wrappers.
In your specific case, the TortoiseMerge documentation has an appendix explaining how to use it from the command line. The essential switches are
/base
,/mine
, and/theirs
, but you may want to use more (you're writing your own wrapper script, after all). TortoiseMerge also allows a "simplified form" of the command:The way to communicate the results of your merge back to Subversion is by writing the merged file to standard output and returning an appropriate value. This information is placed prominently in the wrapper templates in the Subversion manual.