Showing posts with label Diff. Show all posts
Showing posts with label Diff. Show all posts

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

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.