P2D3::Kaleidoscope not working as diff tool

Issue #163 resolved
Maya Studios
created an issue

The diff tool "Kaleidoscope" (http://www.kaleidoscopeapp.com/ ) doesn't work as diff tool.

Comments (23)

  1. Maya Studios reporter

    I've tried to find the problem myself but I've almost no knowlegde of Objective-C. But as far as I could figure it out, the command and its arguments MacHg is invoking is correct. My guess then would be that an important environment variable is missing.

  2. Jason Harris repo owner

    - Fix #163. Most users likely have /usr/bin/local on their path through /.MacOSX/environment.plist but some don't as in the report of #163. Make MacHg add /usr/bin/local to the path if its not already on the path when calling external functions. This solves #136 since the Kaleidoscope scripts require this to be on the path. Thanks to George for finding this!

    8fbe3002f8af

  3. Maya Studios reporter
    • changed status to open

    Just updated to MacHg 0.9.14. Unfortunately this fix didn't work (at least not for me).

    It doesn't work from the GUI (when clicking on "Diff"; "FileMerge" works, however) but it works from the console (opened when I click the "Terminal" button in MacHg). Works with "hg", "mhg", and "chg".

    I also found out that "/usr/local/bin" was already on the path.

  4. Jason Harris repo owner

    Thanks for testing this! (Darn that the fix didn't work...)

    Testing to see if '/usr/local/bin' is on the path for applications (like MacHg) is actually different then seeing if it is on the path for the command line unfortunately. (.bashrc is executed for every terminal shell and that normally set up paths.)

    So can I ask do you have a /.MacOSX/environment.plist file which when open sets the path?

    Mine looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>PATH</key>
            <string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/Users/jason/bin:</string>
    </dict>
    </plist>
    

    Sebastian (and others suffering from the same problem) Can I get you to:

    1. Add / and or modify this environment.plist file (instructions are here)
    2. Restart (to pick up the changes.)
    3. Retry the diffing from MacHg
    4. Turn the logging up to the maximum
    5. Look at the log file at /tmp/MacHgTransactionLog
    6. Search for the diff command the MacHg issued
    7. Open a terminal from MacHg so you get the chg and mhg commands
    8. Try that exact command from step 6 in this terminal session of step 7
    9. Also can you try testing with the /.hgrc on the path and off the path. (You set this in the Advanced tab of the MacHg preferences.)

    Thanks for helping me track this down!

    Cheers, Jas

  5. dak180

    Not sure if this helps but I have a section in my .profile that has:

    ###
    launchctl setenv SSH_AUTH_SOCK ${SSH_AUTH_SOCK}
    launchctl setenv PATH ${PATH}
    ##
    

    I do for two reasons: SSH_AUTH_SOCK is set dynamically every time you log in, also values set in .MacOSX/environment.plist may not be available to process that are not started by Finder (i.e. command line or spotlight).

  6. Maya Studios reporter

    Thanks Jas, your suggestion with the "environment.plist" fixed the problem for me. Now, Kaleidoscope works.

    One thing is strange, however. The log file doesn't contain the diff command (ksdiff). I've set the logging to high (which is "All Generated HG Commands", I guess) and then I've removed all content from the log file. After this I clicked the diff button and only this appeared in the log file:

    MacHg issued(2011-02-08 10:57:14 +0100):
    /Applications/MacHg.app/Contents/Resources/localhg status --cwd /Users/manski/Documents/Programmieren/mamp-htdocs/wordpress-latest/wp-content --modified --added --removed --no-status /Users/manski/Documents/Programmieren/mamp-htdocs/wordpress-latest/wp-content/.hgignore 
    Result code was:0
    Standard out was:
    .hgignore
    
    Standard error was:
    
    

    I get the exact same message when running MacHg without "environment.plist" (when diff isn't working). So there's no real error message when this fails.

    I also found out that starting MacHg from the terminal (which strangly has "/usr/local/bin" in its path) via "open /Application/MacHg.app" does solve the problem, too.

  7. Jason Harris repo owner

    Thanks Sebastian!

    Ok I at least know now to try rolling my environment plist back restarting and then tracing down why this isn't going...

    Thanks! Jas

  8. Vlad Andersen

    Hi Jas,

    I'm working with MacHg and Kaleidoscope and was looking for the ways to make them work together. As for ksdiff command not working, the problem actually was at Kaleidoscope's app (it wasn't able to figure out its path when run from NSTask instance). This is fixed by adding PATH=$PATH:/usr/local/bin after shebang to /Applications/Kaleidoscope.app/Contents/Resources/wrappers/hg. I've written to Kaleidoscope developers about the bug, and they should fix it in next versions out of the box.

    However, the newest versions of MacHg introduced a new bug with Kaleidoscope. When running a diff command, only the first file out of several gets actually diffed. Actually, as I could see from the code, the present behavior for MacHg is running a series of simultaneous diff commands in background. Kaleidoscope expects instead to list all the files being diffed in one command, e.g. hg ksdiff --cwd /dir/ file1 file2

    I've wrote a small patch to implement such behavior. Perhaps it will be suitable not for Kaleidoscope only, but for other diff programs as well.

    Thanks for you great work on MacHG!

  9. Jason Harris repo owner

    Thanks Vlad! I had noticed this as well... and had been meaning to fix it. You patch appears to be good after skimming it! Thanks!

    I wonder how we could generalize this a little... I guess it will wait until I add extensions and plugins for MacHg and one of the things to plugin would be external differs... But if you can think of a generalization at the moment then that would also be welcomed...! :)

    I'll pull your change in within the next cycle... It will be a few days to a week before its officially in the main repository.. But again thanks!!!

    Cheers, Jas

  10. Tim Keating

    The problem is that the initial bugfix has a bug in it.

    The function TaskExecutions:processedPathEnv uses this (line 239) to detect a colon at the end of the path:

    	BOOL colonTerminated = [pathEnv isMatchedByRegex:@".*:"];
    

    This will only work when there is exactly 1 path element with a colon after it, because it returns true if there is a colon anywhere in the path. The correct regex should be:

    	BOOL colonTerminated = [pathEnv isMatchedByRegex:@":$"];
    

    or perhaps even better:

    	BOOL colonTerminated = [pathEnv hasSuffix:@":"];
    

    Either of those worked for me.

    TK

  11. Vlad Andersen

    Hi Jas,

    I believe the best way to do it is like it's done in Versions, a great SVN client for Mac. There's a big list of comparison engines: Versions detects automatically if one is installed and displays it as a list. Furthermore, there's always a possibility to use custom comparison scripts (you just put it in a specific directory): http://versionsapp.com/viewdocpage/versions_wf_compare.html

    So perhaps the best way to do that is to maintain a small list of comparison tools: the user can select one, and the underlying hg command would be constructed automatically based on the optimal settings for a given comparison tool.

    Perhaps the first step to that could be actually adding Kaleidoscope and maybe Changes to the Merge and Diff tool dialogue together with FileMerge.

  12. Jason Harris repo owner

    - From the preferences add a drop down menu where you can select your external diffing tool. The setup should be automatic. If the diffing tool is not on your machine you will be warned. If it is on your machine then MacHg will configure its /Library/ Application Support/MacHg/hgrc file for this diff tool. - Diff tools currently supported are: FileMerge, AraxisMerge, P4Merge, DiffMerge, KDiff3, DelatWalker, Kaleidoscope, Changes, DiffFork, BBEdit, TextWrangler - Add some common diff tool settings directly to the hgrc so that the tool integration is easier. - (Thanks to the folks at Araxis I am allowed to include their scripts in MacHg!) - Add utility ensureFileExists:orCopyFromBundleResource: to ease the copying of files from the application bundle. - Fixes issue #76, #98, #122, #163

    Wiki macro error: Changeset 0e84e8688633 not found.

  13. Jason Harris repo owner

    - From the preferences add a drop down menu where you can select your external diffing tool. The setup should be automatic. If the diffing tool is not on your machine you will be warned. If it is on your machine then MacHg will configure its /Library/ Application Support/MacHg/hgrc file for this diff tool. - Diff tools currently supported are: FileMerge, AraxisMerge, P4Merge, DiffMerge, KDiff3, DelatWalker, Kaleidoscope, Changes, DiffFork, BBEdit, TextWrangler - Add some common diff tool settings directly to the hgrc so that the tool integration is easier. - (Thanks to the folks at Araxis I am allowed to include their scripts in MacHg!) - Add utility ensureFileExists:orCopyFromBundleResource: to ease the copying of files from the application bundle. - Fixes issue #76, #98, #122, #163

    bdf99aad9554

  14. Log in to comment