Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Multiple instances of P4Merge

Steven Pavett October 19, 2011

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

0 votes
Steven Pavett October 20, 2011

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

0 votes
Steven Pavett October 20, 2011

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"

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2011

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!

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2011

Tracking this here: SRCTREE-735

Steven Pavett October 20, 2011

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

0 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2011

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events