Thursday, 31 January 2008
Zoom forward a year and a bit, I use TFS at work now, I hate the Microsoft merge tool, so I'm writing a fresh one. I've got the two-way diffs all sorted (should be released this weekend) and I'm feeling all cocky, I can read the diff3 output, and I'm ready to go...
So you've got add, deletes and changes, easy. You have changes which are the same in both server and local files, you don't have to anything with these, easy. You have changes only on the server, these can merge straight into the local target, still easy. You have different changes to server and local, mark it up as a conflict, still pretty easy. These conflicts can be any of the three types on either side. Arrrggghhh! How many variations of add, deletes and changes do you end up with? Loads. How many colours do you need to clearly identify them all? Too many!
Here is the V0.1 LizardTF 3-way-diff visualiser. Base/Server changes shown inline on the left, Base/Local changes shown inline on right. Green for inserts, Blue for changes, Red for deletions, pale shades where the same change has already been made to both server and local. Mid colours for changes on the server which are mergeable (no change on local/local matches bases), and dark colours with yellow text and square glyphs for your actual, needs intervention, conflicts. Plus the usual mark up of base/local changes*.
So there you go. No wonder TortoiseSVN was rather colourful.
Scintilla also offers quite nice TipText, so hovering over a marked area will display a pop-up text describing the meaning of the colours. (not shown).
*Only if the local target shares the base with the server. With LizardTF it will be possible to merge changesets/diffs into any target irrespective of origin.
Sunday, 20 January 2008
- Side-by-side or Inline diff views
- Line to line diff shown at bottom for side-by-side view
- Can show any number of context lines in Inline view
- File browser to load alternative right/left files
- Repository browser to load alternative repository files
- Version combos to quickly change which versions you are comparing
- Instance switch to Blame view for either right or left hand side
- Blame shows originating changesets and author for each line and uncommitted local changes if ran for local file. (can also be ran for any repository version)
- All line differences marked in main view
- Find functions - quick find and a more featured find
- Context line options for Side-by-side view
- Click on Blame line/changeset id number to show diff to that version
- Click on Blame line/changeset id to get full description of changeset
- Switch for visible whitespace
Inline, showing only 5 context lines.
Sunday, 13 January 2008
The sourceforge project is still there, but I'll be wrapping it up some time soon.
This blog will be the main place for news on releases.
I've been thinking about conflict resolution, and the ability to merge a changeset into another folder, when they are not TF branches. TortoiseSVN allows this by using GNU Diff and Patch. I'm not that fond of MS TFS DiffMerge program for resolving conflicts and it *always* assumes both sides have a common ancestor. While you could use this for applying a changeset to a new location the fact that it's default output when a conflict is found is to use the base version (rather than the local) is a bit off putting as it makes no sense in this context.
I really didn't want to write a diff/merge tool myself as I figured it would take a long time and there were already so many out there.... however, I couldn't find one that behaved quite how I wanted and one thing led to another.
A diff/merge program has two hard bits and some glue. The hard bits are working out the differences and displaying them. I've used GNU Diff for the first and Scintilla + ScintillaNET for the second. Even with these doing the hard bits I was surprised how quickly it all came together.
I've used Diff many times before and the output is pretty easy to read/parse. I've read about Scintilla, and looked at it briefly before. It is a very comprehensive text editing/rendering component. Many open source text editors use it, as does TortoiseSVN, so it was a fairly obvious, if a little daunting choice. Then I found ScintillaNET and it became a lot less daunting.
The end result, a side-by-side two-way difference display, showing changes, insertions and deletions, an in-line version that does the same, but can be told to show only changes and an optional number of context lines, and ... (small fanfare please) LizardBlame.
Named after TortoiseBlame, this shows where every line of code came from and who put it there. I use to use TortoiseSVN/SVN a lot in a big co-located dev. environment, and this tool was incredibly useful. How many times have you worked on code and seen lines of code that seem so hopelessly wrong and yet somehow vital? With Blame you can quickly see what changeset it came from, and (if you use tickets/work items) find out what piece of work the changeset belonged to. This can be far more useful than most comments.
These are all functionally complete, and just need toolbars, find, next/previous, etc etc options.
The three-way diffs/merging and conflict resolution are to follow, but using Diff3 and Scintilla again, this shouldn't be too bad. A big thanks to GNU, Chris Rickard for his ScintillaNET and the numerous folk behind the Scintilla and GNU projects.
Inline Diff showing before and after in one document
Side-by-Side Diff for easy comparision
LizardBlame, showing the originating changeset and author for each line.
As you can see, there are no bells, no whistles, no toolbars and no options yet. I intend to include a line-to-line comparison underneath for spotting those pesky single charactor/one piece of white space changes; to be able to show multiple files (a whole changeset) one after the other in inline-mode for easy review of whole changesets (pending or existing); and the usual next/previous change navigation and find functions.
If anyone has any other features they think are missing from other Diff tools, please let me know.
I've not had a chance to release any source/install for this yet.
Tuesday, 8 January 2008
If you are writting shell extention context menus you will use the IContextMenu interface. MSDN says:
'InvokeCommand returns S_OK if the command was successfully invoked or an appropriate error message if it was not.'
What is does not say is that if your implementation of InvokeCommand is not handling the particular menu item requested it MUST return E_FAIL (0x80004005) otherwise further menu item handling is not called.
Many thanks to Dan Brewer from Extensis for his help with this
Monday, 7 January 2008
Review Form For Checkins/Undos/Gets
Hierarchical diff tool can diff between file system folders and/or
any branch/version repository folders.
It's hosted here: https://sourceforge.net/projects/lizardtf/
I'll shut up about it now.