本文介绍了对 VS 2012 合并工具的命令行访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究在 Windows 7 上使用 TFS 2012 作为 Matlab 的源代码控制提供程序.这需要安装 VS 2012 shell/TFS 客户端,以及可从 Microsoft 免费下载的 64 位 MSSCCI 提供程序.我已经设置了所有这些,并且运行正常.

I am investigating using TFS 2012 as the Source Control provider for Matlab, on Windows 7. This requires installing the VS 2012 shell/TFS client, and the 64-bit MSSCCI provider available as free downloads from Microsoft. I've set all this up and it works OK.

但是,文件差异和合并存在问题.如果我查看与 VS 2012 Source Control Explorer 的差异,则 VS 2012 Diff 工具运行正常.如果我在 Matlab 中尝试相同的操作(使用源代码管理菜单),我会收到错误无法执行配置的工具".解决冲突时,合并工具中的合并更改"按钮也会发生同样的事情:在 VS 2012 中它可以工作,而在 Matlab 中则不能.

However, there is a problem with file differencing and merging. If I view differences from VS 2012 Source Control Explorer, the VS 2012 Diff tool runs correctly. If I try the same operation from within Matlab (using the Source Control menu) I get an error "Cannot Execute the Configured Tool". The same thing happens with the 'merge changes in merge tool' button when resolving conflicts: in VS 2012 it works, from Matlab, it doesn't.

这似乎是一个已知问题,至少对于尝试驱动 TFS 的其他工具而言是这样.有一种变通方法,即配置 VS 2012 以使用外部差分实用程序.我试过了,它奏效了.此外,我发现如果您将外部差分实用程序配置为 VS 2012 自己的内部"差异工具,则将从 Matlab 正确调用内部工具.

It appears this is a known problem, at least with other tools trying to drive TFS. There is a work-around, which is to configure VS 2012 to use an external differencing utilty. I tried this and it worked. Furthermore, I found that if you configure the external differencing utility to be VS 2012's own 'internal' diff tool, the internal tool will be correctly called from Matlab.

diff 命令是:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

所需的参数是:

 /Diff %1 %2 %6 %7

(即原始文件、修改文件、原始文件标签、修改文件标签).此处有相关文档.

(i.e. original file, modified file, original file label, modified file label). There is documentation on this here.

合并工具问题较多.我在它的命令行上找不到任何特定的文档.我到目前为止最接近的是

The merge tool is more problematic. I can't find any specific documentation on its command line. The closest I've got so far is

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\vsDiffMerge.exe

我很确定这是对的,但我使用的论点

which I'm pretty certain is right, but the arguments I'm using

%1 %2 %1 %2 %3 %4 /m

不太对 - 文件标签不同,差异显示的格式不同(来自正常的内置工具).我从一些与 git 相关的文档 这里 但我对 git 一无所知,也不会说意大利语.有人能帮我找到正确的命令行选项吗?

are not quite right - the file labels are different, and the difference display is formatted differently (from the normal built-in tool). I reverse-engineered this command line from some git-related documentation here but I don't know anything about git, nor do I speak Italian. Can anybody help me find the correct command line options to use, please?

编辑添加

有一个 MSDN 讨论似乎与这个问题有关 此处.看起来它发生在其他工具上并且不限于 Matlab:我已经相应地重新标记了这个问题

There is an MSDN Discussion which seems to be related to this problem here. It looks like it happens with other tools and is not limited to Matlab: I've re-tagged this question accordingly

编辑添加

Diff 功能的首选命令行是:

The preferred command-line for the Diff functionality is:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\vsDiffMerge.exe

和命令行参数是:

/t %1 %2 %6 %7

Merge 功能的等效项不起作用:这是一个内部错误 &微软已经承认这一点.

The equivalent for the Merge functionality does not work: this is an internal bug & Microsoft have acknowledged this.

推荐答案

vsDiffMerge.exe 工具似乎适用于差异化和三向合并.我成功地将 VS diff/merge 工具与 Perforce 客户端集成在一起,以进行合并和集成.

The vsDiffMerge.exe tool appears to work for both diffing and three-way merging. I was successfully able to integrate the VS diff/merge tool with the Perforce client for merging and integrating.

提供给工具的参数(至少对于 Perforce)是:

The arguments to be provided to the tool (at least for Perforce) are:

差异

vsDiffMerge.exe /t %1 %2

地点:

  • /t(在临时标签中打开,在永久标签中打开)
  • %1(第一个文件)
  • %2(第二个文件)

合并:

vsDiffMerge.exe /m %1 %2 %b %r

地点:

  • /m(合并操作,离开做一个差异)
  • %1(他们的/源文件)
  • %2(您的/目标文件)
  • %b(基础文件)
  • %r(结果文件)

注意:%"解释来自 Perfore 文档:http://www.perforce.com/perforce/doc.current/manuals/p4v/Configuring_display_preferences.html#Diff

Note: The "%" explanations came from Perfore documentation at: http://www.perforce.com/perforce/doc.current/manuals/p4v/Configuring_display_preferences.html#Diff

对不起大家,我不确定我是如何把它混在一起的.根据我今天的测试,Mark Sowul 是完全正确的.我已经确定了我的答案.此外,对于在第一条评论发布后没有立即纠正这一点表示歉意.我刚从海外旅行回来.

Sorry everyone, I'm not sure how I mixed that one up. Mark Sowul is entirely correct by my testing today. I have fixed my answer. Also, apologies for not getting this corrected as soon as the first comment was posted. I just arrived back home from an overseas trip.

这篇关于对 VS 2012 合并工具的命令行访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 08:41