Thursday 31 January 2008

Well, it's certainly colourful...

I use to use TortoiseSVN a lot. It is the inspiration for LizardTF. I was pretty good at branch management and use to do the hard to keep up with merges for some of my colleagues. I quite liked the 3-way diff/merge tool, but could never understand all the colours. It seemed to have hundreds, and I never found a key.

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

Blame and Diff 2

It's nearly complete now, and will be in the next alpha release in the next couple of days. One window shows diffs and blames and allows the user switch between. Nice features are:
  1. Side-by-side or Inline diff views
  2. Line to line diff shown at bottom for side-by-side view
  3. Can show any number of context lines in Inline view
  4. File browser to load alternative right/left files
  5. Repository browser to load alternative repository files
  6. Version combos to quickly change which versions you are comparing
  7. Instance switch to Blame view for either right or left hand side
  8. 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)
Not implemented yet but coming soon features include:
  1. All line differences marked in main view
  2. Find functions - quick find and a more featured find
  3. Context line options for Side-by-side view
  4. Click on Blame line/changeset id number to show diff to that version
  5. Click on Blame line/changeset id to get full description of changeset
  6. Switch for visible whitespace
Of course, all this is the build up to the 3-way diff/merge tool and conflict resolver. I think I know technically how it's all going to hang together, but I think it's one of those things that you can only get the UI right by trying it. I'm probably going to try to implement a Side-by-side diff view with the merge results underneath, and a side-by-side-by-side view. Hopefully my Scintilla skills will be up to the job of allowing free editing in the merge view window as well as just adding changes from either side.

Diff tool showing side-by-side view


Blame; red shows uncommitted changes, green the last additions

Inline, showing only 5 context lines.

While getting these screen shots I discovered that if the focus is on the Version combo, and you use the mouse scroll wheel Lizard Diff very quickly compares and displays diffs for each version you scroll though, which is really off putting when you think you're scrolling the main window.

Sunday 13 January 2008

LizardTF has moved

I've moved LizardTF from sourceforge to CodePlex. It makes more sense to host a TFS Client project on a site that uses TFS. All new release/news etc will be made at:
http://www.codeplex.com/lizardtf.

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.

LizardBlame

I really didn't mean to write this just yet.

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

Windows Key + E stops working

I use the Windows Key + E all the time to launch explorer, so when it stopped working I was rather miffed. Much searching found little advice except registry settings to turn off/on short cut keys, and advice on uninstalling certain software the used shell extention Context Menus. Seeing as I had just written a shell extention context menu, this seemed like a pretty likely cause. Eventually I found a forum where users of Portfolio (by Extensis) had the problem, Extensis had recommended uninstalling the menu component, however one of their developers had added a note that he had fixed the problem. I emailed him and he replied (despite being on holiday an the time).

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

In The Beginning

Often I google for techy things that I think should be well documented and easy to find but aren't. This blog is for collecting those things so I can find them again, and hopefully others can find them too. This blog is also for shamelessly plugging my open source, MS Team Foundation (TFS), explorer-based client: LizardTF. It looks like this:

Status and Version Information As Seen In Explorer
Review Form For Checkins/Undos/Gets
Hierarchical diff tool can diff between file system folders and/or
any branch/version repository folders.
It's a lot like TortoiseSVN, SVN-TFS Bridge and Dubblebock only in one, built for TFS, package.
It's hosted here: https://sourceforge.net/projects/lizardtf/

I'll shut up about it now.