将 TortoiseMerge 设置为 SVN 的外部合并工具?

发布于 2024-08-23 08:37:24 字数 205 浏览 7 评论 0原文

是否可以将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 技术交流群。

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

发布评论

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

评论(2

难得心□动 2024-08-30 08:37:24

创建一个如下所示的 bat 脚本:

"c:\Program Files\TortoiseSVN\bin\TortoiseMerge.exe" /base:"%1" /theirs:"%2" /mine:"%3" /merged:"%4"

然后将 SVN_MERGE 环境变量设置为该 bat 脚本:

set SVN_MERGE=c:\bin\svnmerge.bat

Create a bat script that looks like this:

"c:\Program Files\TortoiseSVN\bin\TortoiseMerge.exe" /base:"%1" /theirs:"%2" /mine:"%3" /merged:"%4"

Then set the SVN_MERGE environment variable to that bat script:

set SVN_MERGE=c:\bin\svnmerge.bat
維他命╮ 2024-08-30 08:37:24

我不知道您使用的是哪个版本的 Subversion,因此我将尝试参考最新版本的 Subversion 文档,适用于 1.6。 (他们在该页面上添加了“如果您为特定部分添加书签或链接,这些链接可能会因继续开发而失效。”但是 1.6 没有稳定的版本。)

首先,坏消息

要使用合并工具,您需要
设置 SVN_MERGE 环境
变量或定义 merge-tool-cmd
Subversion 中的选项
配置文件(参见章节
称为“配置选项”
更多细节)。颠覆将会过去
合并工具的四个参数:
文件的 BASE 修订版,
收到的文件的修订
服务器作为更新的一部分,复制
包含您本地的文件的
编辑以及文件的合并副本
(其中包含冲突标记)。如果
您的合并工具需要参数
以不同的顺序或格式,您将
需要编写一个包装脚本
要调用的 Subversion。

稍微好一点的消息是 Subversion 在某种程度上已经预料到了你的问题。请参阅 使用部分外部差异和合并工具;有外部合并工具包装器的模板。

在您的具体情况下, TortoiseMerge 文档 具有 < a href="http://tortoisesvn.net/docs/release/TortoiseMerge_en/tme-automation.html" rel="nofollow noreferrer" title="Automating TortoiseMerge">一个附录解释如何从命令行。基本的开关是 /base/mine/theirs,但您可能想使用更多(您正在编写自己的包装器)毕竟是脚本)。 TortoiseMerge 还允许使用“简化形式”的命令:

TortoiseMerge BaseFilePath MyFilePath TheirFilePath

将合并结果传达回 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:

To use a merge tool, you need to
either set the SVN_MERGE environment
variable or define the merge-tool-cmd
option in your Subversion
configuration file (see the section
called “Configuration Options” for
more details). Subversion will pass
four arguments to the merge tool: the
BASE revision of the file, the
revision of the file received from the
server as part of the update, the copy
of the file containing your local
edits, and the merged copy of the file
(which contains conflict markers). If
your merge tool is expecting arguments
in a different order or format, you'll
need to write a wrapper script for
Subversion to invoke.

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:

TortoiseMerge BaseFilePath MyFilePath TheirFilePath

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.

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