How to use TortoiseMerge from Perforce P4V?

2019-08-05 15:26发布

How can I configure Perforce to use the tool TortoiseMerge for diff and merging?


I tried arguments

/base:%1 /mine:%2

enter image description here

following http://tortoisesvn.net/docs/release/TortoiseMerge_en/tme-automation.html and http://www.perforce.com/perforce/doc.current/manuals/p4v/Configuring_display_preferences.html#Diff . The Perforce docs say

Specify arguments for third-party diff applications in the Arguments field: Enter %1 for the name of the first file and %2 for the name of the second file. P4V replaces these placeholders with the actual filenames when calling the diff application.

Yet when I try it, TortoiseMerge errors "Can't open file %1" suggesting P4V didn't replace the arguments and left %1 as is

enter image description here

3条回答
Bombasti
2楼-- · 2019-08-05 16:11

There is an existing enhancement request because P4V does not substitute values for %b, %1, %2, and %r if these arguments are not by themselves. For example, P4V does not substitute:

 /base:%b /theirs:%1 /mine:%2 /merged:%r

which are needed by TortoiseMerge.

However, one user reported that the command worked once he added the quotes around the pathname due to the spaces in it. For example:

start /WAIT "C:/Program Files/Beyond Compare 3/BComp.exe" %1 %2 %3 /mergeoutput=%4

Thus as a workaround, you can augment the %b %1 %2 %r arguments in a script that calls TortoiseMerge. In TortoiseMerge's case, you would have a line like this:

 c:"\the_path_to_TortoiseMerge" /base:%1 /theirs:%2 /mine:%3 /merged:%4
查看更多
姐就是有狂的资本
3楼-- · 2019-08-05 16:12

You can do this by creating a bat file. In the bat file you can call the merge program with the correct arguments. This is the content of my bat file:

TortoiseMerge.exe /base:%1 /theirs:%2 /mine:%3 /merged:%4

The settings in p4 %b %1 %2 %r : Settings in P4

As you can see I called my bat file "p4Helper.bat"

查看更多
何必那么认真
4楼-- · 2019-08-05 16:27

Sadly P4V's argument replacement is broken. You can use TortoiseMerge for diffing, but not merging.

To set up TortoiseMerge for diffing, use the argument string %1 %2

enter image description here

The correct arguments for merging would be

/base:%b /theirs:%1 /mine:%2 /merged:%r

However it gives this error

enter image description here

Presumably what's happening is that P4V fails to replace the '%b' in /base:%b with the appropriate file path.

查看更多
登录 后发表回答