Side by Side Diff

Posted by toddw on 2009-07-26 22:13 | Staff Pick!
0.2.4
Todd Whiteman
Wed, 2013-02-27 15:22
  • : 5.2.0-alpha1 - 8.*
  • : 5.2.0-alpha1 - 8.*

Provides the ability to view a Komodo diff using a side-by-side layout.

Note: This extension requires Komodo 5.2.0 or newer:
http://downloads.activestate.com/Komodo/releases/

Usage
Once installed, when launching a Komodo diff, you'll find a new toolbar at the top of the diff dialog that will allow you to switch between the regular Komodo diff view and a new side-by-side diff view.

Features

  • Highlighting of the changed context
  • The ability to show full contextual diffs - click on the expand markers to see the file file contents in the diff window
  • Syntax highlighting (colorizing) of the diff text
  • Reveal position - through the right-click contextual menu

Side by side diff screenshot

Future Ideas

  • Jumping to next/previous locations
  • Colorizing using current Komodo scheme colors

About

This extension generates a html-diff output to display in a browser preview. The html diff generation technique is based upon Review Board, reusing the differencing code tools within the reviewboard project. Reviewboard itself makes uses of Django, Pygments and other Python libraries.

Source code
http://svn.openkomodo.com/openkomodo/browse/addons/sbsdiff

dlaflam | Wed, 2010-02-24 12:46

When you activate the Side by Side view mode, would there be anyway to get the 'Reveal Position in Editor' link(s) functionality to work for Komodo 5.3? It does work when you are in the Contextual mode.

Many thanks,

toddw
ActiveState Staff
Thu, 2010-02-25 09:55

You can right-click on the point you wish to locate and then use "reveal" from the context menu.

Cheers,
Todd

dlaflam | Sat, 2010-04-17 15:55

Unfortunately, that hasn't worked in 5.3 by right clicking the change point number and clicking 'reveal' in the context menu. It has always produced this error: [Javascript Application] Unable to reveal the position at this location.
Will this work in 6.0?

Also, why the big jump in software version numbers? I don't believe 5.3 was ever released as I got this copy from the code repo. More importantly, where were the 5.3 - 5.9 releases at?

Are there going to be some enhancements to the UI design of the software itself, Improvements, etc... ?
Will there be support for the LESS CSS framework, as well as the javascript Code Intelligence getting updated so it has the newest libraries like jquery 1.4 and YUI3 support?

sproutworks | Tue, 2010-10-26 08:49

Thanks for creating this, it is a good improvement to the default diff.

I noticed that files with very long lines can cause the side by side window to have so much horizontal scrolling that the 2 columns can not be viewed at the same time. Maybe the diff window could have 2 panes with linked scrolling so that both columns are always visible.

I also had a particular file where the entire file was displayed in the right column all in green, when I had just added 2 lines to my working copy.

buckthron | Thu, 2011-01-27 12:33

Thanks for creating this extension. I suppose the only thing that could be better than this is the ability to merge, a la FileMerge. BBEdit also has a really nice compare files feature -- maybe the best I've seen.

juampa | Wed, 2011-02-09 08:55

I have updated this add-on to the latest version but I still have a disabled syntax highlighting check box. It is the same behavior in Komodo IDE 5 or 6, and even in other computers. I am using OS X 10.6.6. Any ideas?

toddw
ActiveState Staff
Wed, 2011-02-09 14:03

This is because the syntax highlighting requires information on the file's location, but some of Komodo's diff features (Show Unsaved Changes, SCC History) don't provide this information... I'll see if I can work around this problem to make it work.

marcc | Tue, 2011-04-26 16:36

Hi Todd,

Any luck on getting this this work?

Also, I too would like to have both panes fit on my screen without having to scroll sideways. Will that feature be added?

Thanks,
Marc

robert.joy@xirr... | Thu, 2011-12-29 08:27

I loaded this and it's not functional. The pulldown menu shows up in the diff window but when I select side by side nothing shows up. Are there any items that must be installed on my machine, like Python, etc?

toddw
ActiveState Staff
Thu, 2011-12-29 10:17

There are no additional dependencies - just Komodo.

Check Komodo's "Help > Troubleshooting > View log file" to see if there are any errors.

Thanks,
Todd

robert.joy@xirr... | Thu, 2011-12-29 10:56

Here's all the log. Also, the patch.exe file pops up but does not go away. It looks like it's not actually running:

C:\Program Files\ActiveState Komodo IDE 6\lib\mozilla\python\komodo\Crypto\Util\randpool.py:40: RandomPool_DeprecationWarning: This application uses RandomPool, which is BROKEN in older releases. See http://www.pycrypto.org/randpool-broken
RandomPool_DeprecationWarning)
C:\Program Files\ActiveState Komodo IDE 6\lib\mozilla\python\komodo\twisted\cred\identity.py:23: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5, types, sys, warnings
[2011-12-29 09:46:33,591] [WARNING] view.startpage: `koIView.document` is deprecated, use `koIView.koDoc`

anonymous@chrome://komodo/content/library/logging.js:118
get_document@viewstartpage:0
anonymous@chrome://sourcetree/content/sourcetree.js:336
anonymous@chrome://sourcetree/content/sourcetree.js:305
anonymous@chrome://sourcetree/content/sourcetree.js:701
observeViews@chrome://sourcetree/content/sourcetree.js:757
anonymous@chrome://xtk/content/domutils.js:61
initWithDocument@viewstartpage:1195
createViewFromDocument@viewlistbase:87
anonymous@chrome://komodo/content/views.js:568
anonymous@chrome://komodo/content/views.js:692
open_openStartPage@chrome://komodo/content/library/open.js:334
anonymous@chrome://komodo/content/views.js:2961
view_restoreWorkspace@chrome://komodo/content/views.js:2850
onloadDelay@chrome://komodo/content/komodo.js:328

[2011-12-29 09:46:34,464] [ERROR] uilayout:
-- EXCEPTION START --
+ 0 (string) Couldn't save selected tab preferences:TypeError: tabbox.selectedTab is null
*
-- EXCEPTION END --

ERROR:xpcom:Unhandled exception calling 'int8 generateSbsDiff(in nsISomething, out retval wstring);'
Traceback (most recent call last):
File "C:\Program Files\ActiveState Komodo IDE 6\lib\mozilla\python\xpcom\server\policy.py", line 277, in _CallMethod_
return 0, func(*params)
File "C:\Users\robert.joy\AppData\Local\ActiveState\KomodoIDE\6.1\XRE\extensions\sbsdiff@activestate.com\components\sbsDiff.py", line 92, in generateSbsDiff
return self.html_template % (sbsdiff.toHTML())
File "C:\Users\robert.joy\AppData\Local\ActiveState\KomodoIDE\6.1\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 665, in toHTML
d.load_chunks()
File "C:\Users\robert.joy\AppData\Local\ActiveState\KomodoIDE\6.1\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 608, in load_chunks
chunks = get_chunks(self, None, 0, self.enable_syntax_highlighting)
File "C:\Users\robert.joy\AppData\Local\ActiveState\KomodoIDE\6.1\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 340, in get_chunks
old = filediff.get_original_file()
File "C:\Users\robert.joy\AppData\Local\ActiveState\KomodoIDE\6.1\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 587, in get_original_file
self._left_contents = self._patch_file(self.diff, right_contents, reversed=True)
File "C:\Users\robert.joy\AppData\Local\ActiveState\KomodoIDE\6.1\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 566, in _patch_file
stdout, stderr = p.communicate(diff)
File "C:\Program Files\ActiveState Komodo IDE 6\lib\python\lib\subprocess.py", line 701, in communicate
return self._communicate(input)
File "C:\Program Files\ActiveState Komodo IDE 6\lib\python\lib\subprocess.py", line 911, in _communicate
self.stdin.write(input)
IOError: [Errno 22] Invalid argument

robert.joy@xirr... | Mon, 2012-02-13 13:27

Can you please fix this? Would love to use it but not even possible at this point. Thanks!

aussiejohn | Tue, 2012-02-07 18:24

Hi Todd,

I just installed SBS Diff on Komodo IDE 7 and it appears to not be working.

System: Windows 7 Professional, 64-bit.
Komodo IDE, version 7.0.0, build 68957, platform win32-x86.
(While it's a fresh install of Komodo IDE 7 (trial), I also have Komodo Edit 6.1.3 installed and am syncing settings between my home and work computer. The issue occurs on both.)

The relevant part of my error log shows:

ERROR:xpcom:Unhandled exception calling 'int8 generateSbsDiff(in nsISomething, out retval wstring);'
Traceback (most recent call last):
File "C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\mozilla\python\xpcom\server\policy.py", line 310, in _CallMethod_
return 0, func(*params)
File "C:\Users\johnv\AppData\Local\ActiveState\KomodoIDE\7.0\XRE\extensions\sbsdiff@activestate.com\components\sbsDiff.py", line 92, in generateSbsDiff
return self.html_template % (sbsdiff.toHTML())
File "C:\Users\johnv\AppData\Local\ActiveState\KomodoIDE\7.0\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 665, in toHTML
d.load_chunks()
File "C:\Users\johnv\AppData\Local\ActiveState\KomodoIDE\7.0\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 608, in load_chunks
chunks = get_chunks(self, None, 0, self.enable_syntax_highlighting)
File "C:\Users\johnv\AppData\Local\ActiveState\KomodoIDE\7.0\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 340, in get_chunks
old = filediff.get_original_file()
File "C:\Users\johnv\AppData\Local\ActiveState\KomodoIDE\7.0\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 587, in get_original_file
self._left_contents = self._patch_file(self.diff, right_contents, reversed=True)
File "C:\Users\johnv\AppData\Local\ActiveState\KomodoIDE\7.0\XRE\extensions\sbsdiff@activestate.com\pylib\sbs_diff_helper.py", line 565, in _patch_file
p = subprocess.Popen(argv, stdin=PIPE, stdout=PIPE, stderr=PIPE)
File "C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\python\lib\subprocess.py", line 633, in __init__
errread, errwrite)
File "C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\python\lib\subprocess.py", line 842, in _execute_child
startupinfo)
WindowsError: [Error 740] The requested operation requires elevation
[2012-02-08 12:16:40,940] [ERROR] diff:
-- EXCEPTION START --
+ QueryInterface (function) 3 lines
+ message (string) 'WindowsError: [Error 740] The requested operation requires elevation'
+ result (number) 2147500037
+ name (string) '_execute_child'
+ filename (string) 'C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\python\lib\subprocess.py'
+ lineNumber (number) 842
+ columnNumber (number) 0
+ location (object) File "C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\python\lib\subprocess.py", line 842, in _execute_child
| + QueryInterface (function) 3 lines
| + language (number) 0
| + languageName (string) 'Python'
| + filename (string) 'C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\python\lib\subprocess.py'
| + name (string) '_execute_child'
| + lineNumber (number) 842
| + sourceLine (string) 'startupinfo)'
| + caller (object) File "C:\Program Files (x86)\ActiveState Komodo IDE 7\lib\python\lib\subprocess.py", line 633, in __init__
| *
+ inner (object) null
| *
+ data (object) null
| *
*
-- EXCEPTION END --

fulopattila122 | Mon, 2012-02-13 12:42

Hi,

first of all this side by side diff is the Best Thing[tm] for Komodo IDE.

However on Ubuntu I get this error message:
SVNLibError(u"Error running '/usr/bin/svn diff Subscriber.php meld', it did not exit properly: rv=1\n\nStderr:\nsvn: 'meld' is not under version control\n",)

I have svn 1.6.12 and meld 1.5.0 installed.

As far as I see it should pass "--diff-cmd meld" to svn instead of just "meld".

Can I fix this myself somehow?

Thank you

ilya_smirnov | Fri, 2012-08-24 11:58

Does not work feature "Reveal Position in Editor".

jghoward | Thu, 2014-03-06 11:19

Forgive me for my inexperience, but how do I use this in Komodo Edit? In the usage section, it is noted "...when launching a Komodo diff, you'll find a new toolbar..."

Strangely a search for "Diff" in the help system has zero results. I've tried compare files, but no new toolbars present.

Thanks,
John

ilya_smirnov | Thu, 2014-03-06 13:38

Install addon "Side by Side Diff" in "Tools" -> "Addons" -> "Extensions" in main menu, then restart Komodo Edit, then open "Tools" -> "Compare Files", then select files to compare in dialog window and push button "Compare Files", then select diff style: "side-by-side" in window.

jghoward | Fri, 2014-03-07 06:07

Thank You