4

I have integrated p4merge with git on my MacBook Pro OS X Yosemite.

It works great with one issue. When difftool or mergetool open p4merge and I have completed my task I tend to click on the red X to dismiss my window. However this doesn't exit the application, only the window for that particular window for the file opened. This hangs up the mergetool or difftool session preventing the next file from being processed until I go to the p4merge menu bar and select "Quit P4Merge" (or command-Q).

Is it possible to configure p4merge to quit entirely when the window is dismissed ?

1 Answers1

4

I contacted p4merge about this issue and their support was amazing. They pointed me to a Knowledge Base article which solves the issue. http://answers.perforce.com/articles/KB/2848/

If you call p4merge directly on MacOS you will have this issue and need to close p4merge for every file as you use mergetool in git. However if you follow the instructions then you will launch with their launch stub that works with git seamlessly.

I altered the instructions a little myself and installed their wrapper script in my local ~/bin folder which is first in my path. This way I could name it p4merge instead of myp4merge.sh as they suggest and it would launch instead of the p4merge binary since it is earlier in the path.

===============================================

The link is broken now so here is what I currently have in my configuration.

===============================================

In .gitconfig

[diff]
        tool = p4merge
[difftool "p4merge"]
        cmd = /Users/gouldner/bin/p4merge \"$LOCAL\" \"$REMOTE\"
[mergetool "merge"]
        cmd = /Users/gouldner/bin/p4merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"

~/bin/p4merge contains the following

#!/bin/sh

#This shell wraps p4merge to allow it to work with git without having to close the
#application between each file during mergetool and difftool operations
/Applications/p4merge.app/Contents/Resources/launchp4merge $*
  • `launchp4merge` no longer works with Mojave. Have you figured out how to use it with `p4merge` directly? – Halil Dec 18 '18 at 13:50
  • Have you tried using the latest version of p4merge directly? I am on High Sierra but I no longer use launchp4merge shim. I just have git configured with p4merge and it works fine. – Ronald Gouldner Jr Dec 19 '18 at 19:41
  • Link is dead and archive.org doesn't have it archived. This is why link-only answers are disallowed. – BlueRaja - Danny Pflughoeft Feb 08 '23 at 23:05
  • Here is what I have currently in my setup. Sorry about the link. In .gitconfig [diff] tool = p4merge [difftool "p4merge"] cmd = /Users/gouldner/bin/p4merge \"$LOCAL\" \"$REMOTE\" [mergetool "merge"] cmd = /Users/gouldner/bin/p4merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" ~/bin/p4merge contains the following #!/bin/sh #This shell wraps p4merge to allow it to work with git without having to close the #application between each file during mergetool and difftool operations /Applications/p4merge.app/Contents/Resources/launchp4merge $* – Ronald Gouldner Jr Feb 16 '23 at 19:36
  • Comment has bad formatting so see modified answer. – Ronald Gouldner Jr Feb 16 '23 at 19:41