running diffmerge.sh on OS X runs app behing all others

Support for our DiffMerge utility.

Moderator: SourceGear

Post Reply
olek
Posts: 12
Joined: Thu Apr 10, 2008 9:38 am

running diffmerge.sh on OS X runs app behing all others

Post by olek » Thu Apr 10, 2008 9:44 am

Hi

First of all - thank you for wonderful tool.
I really got used to it on linux, but when I tried to use it on mac, I found a problem which makes in very inconvenient to use DiffMerge.

If I run diffmerge by activating its app icon, or using quicksilver, it start correctly, and I immediately see its menu and window.

But when I run diffmerge from command line using supplied script diffmerge.sh, program starts behind all currently running programs, and its menu and window are not visible until I command-tab there.

How can we fix this?

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Update your copy of DiffMerge.sh with the following.

Post by jeffhostetler » Thu Apr 10, 2008 11:03 am

I'm not much of an Apple Script user, but I've managed to get
the following to do what you want. Edit the DiffMerge.sh script
that I shipped with 3.1 and change the "exec ${DIFFMERGE..."
line to the following:
${DIFFMERGE_EXE} --nosplash "$@" &

/usr/bin/osascript - <<EOF
tell application "DiffMerge"
activate
end tell
EOF
this will launch DiffMerge and then bring it to foreground.

It does have a quirk or two -- if you give an invalid file or command
line arg, DiffMerge will give an error dialog and the OSASCRIPT
command will hang for a few seconds before returning an obscure
error message. But if everything is OK with the command line args,
you should be fine.

I plan on putting this change in the next release of DiffMerge.

Let me know if this helps,
jeff hostetler

olek
Posts: 12
Joined: Thu Apr 10, 2008 9:38 am

Post by olek » Thu Apr 10, 2008 12:02 pm

Thank you.

While this fix seems to be a bit like band-aid :) it works indeed.

Since majority of my use for diffmerge is driven by svn, chances of invalid command line args are very slim.

BTW - I have created nice shell script that wraps diffmerge in such a way that it is nice and convenient to use it with svn, I just change svn config file to use that wrapper script for diffing and for conflict resolution, and that is it.
I created it while using linux, but it works fine now with OS X.

If you want it, you can have it 8)

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Sure, post it as a new topic.

Post by jeffhostetler » Thu Apr 10, 2008 3:00 pm

Sure, post it as a new topic. It may be helpful for others.

Thanks,
jeff

olek
Posts: 12
Joined: Thu Apr 10, 2008 9:38 am

Post by olek » Tue Apr 15, 2008 10:13 am

Well, I found a problem with that script that makes it not usable for me.

That solution runs diffmerge in a spawned process, and that means that 'diffmerge' script has become non-blocking. While this would not be a problem for casual user, this makes it impossible to integrate it with subversion because its expectation (valid) is for diff program to be blocking.

BTW - I noticed that there is a number of other programs that have same problem as diffmerge with hiding behind all other windows. 'gitk' is one of them, 'git gui' is another, and there were some others... This is a common problem, something is not right in Leopard...

Anyway, here is a modification of your script that worked for me, making diffmerge again blocking:

Code: Select all


sleep 0.1; osascript -e 'tell application "DiffMerge" to activate' &

exec ${DIFFMERGE_EXE} --nosplash "$@"
Happy diffing! :wink:

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: running diffmerge.sh on OS X runs app behing all others

Post by jeffhostetler » Thu Apr 09, 2009 10:14 am

SourceGear DiffMerge 3.3.0 is now available and addresses this problem. (Actually,
this was present in 3.2.0, but I missed this thread when in my post-release follow-up.)

There is now code inside DiffMerge to try to force itself to the foreground
when launched from the command line/shell script.

Full details can be found at http://www.sourcegear.com/diffmerge/index.html.

jeff hostetler

olek
Posts: 12
Joined: Thu Apr 10, 2008 9:38 am

Re: running diffmerge.sh on OS X runs app behing all others

Post by olek » Thu Apr 09, 2009 10:27 am

Thank you for the follow-up.

Yes, the problem is definitely fixed now :)

Post Reply