Multiple instances of P4Merge

I'm using SourceTree with P4Merge. Everytime I click external diff it launches a separate P4Merge process. Is this deliberate? Not a huge issue just I end up having to close lots of P4Merge processes after checking a diffs for a checkin

3 answers

This widget could not be displayed.

This just appears to be a limitation of P4Merge as far as I can tell - SourceTree simply sets it up as a diff/merge tool for git & hg in the normal way, and I haven't seen any other way of doing it. Other tools don't behave like this!

If you find something in the config (.hgrc / .gitconfig) that can be done to change this behaviour, please let me know, but as far as I can tell the setup is correct.

This widget could not be displayed.

Hi Steve - thanks for your reply.

This works for me (now all diff windows open in a single p4merge process):

create /usr/local/bin/launchp4merge.sh with content

#!/bin/sh

/Applications/p4merge.app/Contents/Resources/launchp4merge $*

and make this executable

chmod +x /usr/local/bin/launcp4merge.sh

then in SourceTree go to preferences -> diff and switch Visual Diff Tool and Merge Tool to Other and put in the values

Diff Command: /usr/local/bin/launchp4merge.sh Arguements:"$LOCAL" "$REMOTE"

Merge Command: /usr/local/bin/launchp4merge.sh Arguements:"$BASE" "$LOCAL" "$REMOTE" "$MERGED"

Thanks - unfortunately calling 'launchp4merge' directly doesn't work, you do have to do it via a wrapper shell script which hard-codes the path, which is tricky when you don't always know where p4merge will have been installed. I'll see if I can find a nice way to make this work in future!

Appears I wasn't 100% right.

P4Merge.app contains both

p4merge.app/Contents/Resources/launchp4merge

and

p4merge.app/Contents/MacOS/p4merge

and both can be called directly without needing to be wrapped in a shell script i.e. in SourceTree you can set Diff Tool to Other and put in the values :

Diff command:/Applications/p4merge.app/Contents/Resources/launchp4merge Arguements:"$LOCAL" "$REMOTE"

And this works fine for committed files - it will diff them in the single p4merge process but it fails when diffing uncommited changes. If p4merge isn't loaded it will load it but no window appears. Strange

This widget could not be displayed.

Appears I wasn't 100% right.

P4Merge.app contains both

p4merge.app/Contents/Resources/launchp4merge

and

p4merge.app/Contents/MacOS/p4merge

and both can be called directly without needing to be wrapped in a shell script i.e. in SourceTree you can set Diff Tool to Other and put in the values :

Diff command:p4merge.app/Contents/Resources/launchp4merge Arguements:"$LOCAL" "$REMOTE"

And this works fine for committed files - it will diff them in the single p4merge process but it fails when diffing uncommited changes. If p4merge isn't loaded it will load it but no window appears. Strange

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

733 views 1 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you