compare text function as in FileMerge?

Pr
Prion
Posts: 97
Joined: Fri Aug 25, 2006 3:14 pm

Wed Dec 06, 2006 4:51 pm Post

With Scrivener being able to display two panes alongside each other, each holding different versions of the same text, I was thinking how helpful it would be to have a visual cue concerning the differences between them.

One of the nicest implementations of suchc functionality is still FileMerge, a program that has been around since NextStep days in the developertools on every OS X install medium.
FileMerge is getting old in the tooth, though, it has problems displaying anything but pure ASCII and some other stuff it simply wasn't designed to handle, but visually it is very intuitive. Much much better than (dare I say it) track changes in Word.

Image



I am probably making a foool out of myself again because KB has already built in this functionality and I have just missed it. But I'd really love to see this in Scrivener. What do you think?

Prion

User avatar
KB
Site Admin
Posts: 20920
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Wed Dec 06, 2006 8:29 pm Post

Hi, no, this functionality is not in Scrivener currently, and there are no plans to implement it. Really, you are talking about true "versioning" (which is why I used the PageFour term, "snapshots", instead of "versions", because Scrivener doesn't do true "versioning"). It is waaaay beyond the scope of Scrivener at this stage. True file comparison as you are proposing is a major undertaking. If Apple ever implement it in their text system "for free", it would make it into Scrivener. Barring that, it is unlikely to make it into Scrivener insofar as my current vison of Scrivener is concerned. Sorry. :)
All the best,
Keith

Pr
Prion
Posts: 97
Joined: Fri Aug 25, 2006 3:14 pm

Wed Dec 06, 2006 9:54 pm Post

Not sure I understand you correctly other than that it is not in and won't be for the foreseeable future :D

I was merely talking about a way to be guided visually where the differences are between two textfiles, nothing fancy here, no history or pedigree of changes first here, then there - just plain and simple: look, this is where they differ.
With Scrivener out of the question are there any tools out there that you know of that act similar to FileMerge and can handle diacritica?

Prion

PS: Don't get me wrong, Keith, I got the impression over the years that a good developer needs to say a firm no from time to time (just not when I make a suggestion :wink: )

User avatar
KB
Site Admin
Posts: 20920
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Wed Dec 06, 2006 10:10 pm Post

Hi,

Actually, there is no such thing as "nothing fancy" in development terms. :) Seriously, consider, how would this be done? FileMerge is actually "something fancy". It is very easy to parse through a file and find the first place that they differ. But after that, things get very complicated quickly. Where do the differences end and the next similarities begin? This requires a lot of intelligence on the part of the program in understanding textual differences.

And I suspect that the reason that it is not easy to name too many programs that do this is precisely because, although from a user's perspective it seems as though it shouldn't be anything too difficult, from a developer's perspective, this would be very difficult to implement properly.

Consider these two pieces of text:

I am going to the supermarket on Tuesday.


It's my tambourine... Doing too much, they are superfluous... I won't mark it until next Wednesday...


Yes, the second sentence is gibberish, but now look at the similarities:

I... am... oing... to... the... super... mark... t... n... sday...

Would these similarities be found, even though they are really different texts? Wouldn't this be meaningless. Could the software really find these anyway in a sensible and efficient manner? How on earth would I program that? And so on...

Hope that makes sense!
Keith

Pr
Prion
Posts: 97
Joined: Fri Aug 25, 2006 3:14 pm

Wed Dec 06, 2006 10:22 pm Post

I am aware of the problem but that doesn't mean that solutions are impossible.
We are beating a dead horse here anyway, I was not expecting you to develop this all by yourself. I simply assumed that this must be a raher fundamental requirement and so I assumed that there were solutions (read: algorithms) out there already.
As much as I am glad I escaped from there, the Windows world is full of free tools that achieve just that: present meaningful differences in an intelligible manner. And there are Mac tools too, maybe I just haven't looked enough.

I am grateful enough for what Scrivener is to be able to see that I am a minority apparently. Thank you
Prion

User avatar
AmberV
Posts: 24641
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Wed Dec 06, 2006 10:26 pm Post

Actually, there would be a way to do this that would not be excessively complicated. Mainly, why re-invent the wheel? While I have no idea if this true, I would be surprised if FileMerge is not simply just a fancy GUI for the command-line tool, 'diff'. Scrivener could export two temporary plain text versions of the document, run them through diff, and then parse the results into a pleasing arrangement like FileMerge.

At its simplest, something like colour coding in MediaWiki (which is probably just wrapping diff as well), and at its most fancy, something like FileMerge with a lot of visual cues.

All of this is still definitely 2.5, but my point is, I don't think you would have to go through the incredibly complicated tasks of rewriting diff to do this. It is a very old and mature piece of software. Naturally, if this ever did come to the board, integration of the snapshot history display into a split would be the way to go.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
KB
Site Admin
Posts: 20920
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Wed Dec 06, 2006 11:07 pm Post

Um, let's schedule this for 4.5, okay? :) Seriously, there is NO way I am even going to think about this during 1.0. I'm not trying to be difficult, just realistic. Development time compared to usefulness, for me, is just not worth it at this point. That doesn't rule it out from the future (I refuse to rule anything out permanently), just for 1.x.
Best,
Keith

ja
janra
Posts: 471
Joined: Sun Jun 18, 2006 12:06 am
Platform: Mac
Location: Vancouver, BC

Thu Dec 07, 2006 5:28 am Post

4.5 sounds fine by me :-)

Actually, I've found diff to have limited usefulness when dealing with prose, so this isn't even a feature I'd ask for.

For code, diff is fantastic, but then code generally has things broken up on a line by line basis and diff compares things on a line by line basis. One command per line, that sort of thing; you'd almost think diff was made for code...

With prose, you don't press enter until the end of a paragraph, so one added or removed comma will flag the entire paragraph as changed in diff. And if you start pressing enter after each line in a paragraph to force wrap it, well then it just gets ugly - if you add three words to a middle line, either your draft copy gets ugly quickly with different length lines, or you rewrap and all following lines are flagged as changed even though only a few words have, simply because of the different positions of the same words.

---

Although on a whim I just googled around and found dwdiff which does a diff word by word. If you ever do decide to do a changes feature, you'd probably want something like this instead of plain diff.

Ra
Rayz
Posts: 558
Joined: Fri Sep 22, 2006 4:43 pm
Platform: Mac

Thu Dec 07, 2006 9:30 am Post

Actually, I've found diff to have limited usefulness when dealing with prose, so this isn't even a feature I'd ask for.

For code, diff is fantastic, but then code generally has things broken up on a line by line basis and diff compares things on a line by line basis. One command per line, that sort of thing; you'd almost think diff was made for code...


My thoughts exactly. Diff is made for code.

The tracking functionality of Word is a work of art, but Word is more of an operating system than an application and the file format is designed to make change tracking easier; I don't think this applies to RTF.

br
brett
Posts: 537
Joined: Tue Jul 11, 2006 3:17 am
Location: yet another Portlander

Thu Dec 07, 2006 11:39 pm Post

Here's a workaround:
1. export both versions to rtf or plain text.
2. Download and open the freeware DiffFrontend.
3. Follow these instructions (from its ReadMe):

What it is:
DiffFrontend is a frontend to the unix utility "diff". The diff utility compares files and explains whether or not the files are the same. For text files, it also lists the differences between the files. For other files, it simply tells you if the files are the same or if they differ.

Usage:
Usage is simple. Open the application and enter the filenames to compare. This can be done in one of four ways. Either type the full path to the files into the boxes (ick), drag the files from the Finder into the text boxes, click the "Select File" buttons next to the boxes and select the files, or use the "Select Files" menu items from the "File" menu to select the files. Once you have selected the files you wish to compare, press "Run Diff" (or choose "Run Diff" from the File Menu) to run the diff program and check for differences.

If you want to see the output of diff (for comparing text files), click on "Show diff output" and the output window for the last time you ran diff will be displayed.

Ma
Maria
Posts: 614
Joined: Thu Jul 13, 2006 5:47 am

Fri Dec 08, 2006 4:31 am Post

del
Last edited by Maria on Sat Feb 16, 2008 8:50 am, edited 2 times in total.

br
brett
Posts: 537
Joined: Tue Jul 11, 2006 3:17 am
Location: yet another Portlander

Fri Dec 08, 2006 6:59 am Post

Well, that's the developer's "ick" (taken from the ReadMe) but it does have wide application, I'll grant you.

I only used DiffFrontend once, more than a year ago, so can't really vouch for it now; on the download page (http://josh.tumaz.com/content/view/33/52/) the developer says he hopes to release an updated version soon.

I seem to remember other apps back in the Classic (system 7ish?) days that did the same thing -- wasn't there one called DocuComp or something like that? It would show added text as underlined, cut text with striktehroughs. It does seem like a function that most word processors could benefit from, but few if any have. I hasten to add that I'm NOT asking for it in Scrivener. This year.

Ma
Maria
Posts: 614
Joined: Thu Jul 13, 2006 5:47 am

Fri Dec 08, 2006 9:42 am Post

brett,

Thanks for explanation and link. DiffFrontend did not work properly with two small text files, maybe it needs some more polishing... No problem at all!

Maria

ch
chris
Posts: 14
Joined: Tue Sep 26, 2006 1:25 pm
Platform: Mac

Fri Dec 15, 2006 8:28 am Post

You might give TextWrangler (free) a try. It is for .txt files only and can compare files for differences by line. BBedit, the "pro" version, does word and character comparisons as well.

http://www.barebones.com/products/textw ... ndex.shtml